write a function to find maximum element of an array using recursion

1 次查看(过去 30 天)
function mx = recursion_max(v)
n=size(v);
if size(v) <2
mx = v(1);
else mx = max(recursion_max(v(n-1)), mx );
end
end

回答(1 个)

Ameer Hamza
Ameer Hamza 2020-9-10
编辑:Ameer Hamza 2020-9-10

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by