225k views
1 vote
Which repetition approach is less efficient a loop or a recursive function why?

1 Answer

7 votes
In general loops are less efficient because they have to go through data one at a time no matter what. Recursion allows you to split the data into smaller pieces each time the function is called. In general terms the efficiency of loops is x and the efficiency of recursion is log(x)
User Omab
by
8.7k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.