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

6 vues (au cours des 30 derniers jours)
Piyush Gupta
Piyush Gupta le 10 Sep 2020
Modifié(e) : Ameer Hamza le 10 Sep 2020
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

Réponses (1)

Ameer Hamza
Ameer Hamza le 10 Sep 2020
Modifié(e) : Ameer Hamza le 10 Sep 2020

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by