Computer Science, asked by Premish1905, 1 year ago

When is it better to use iteration rather than recursion?

Answers

Answered by jainkumarrockspd8mo7
0
It is always recommend to use iteration bcz of time complexity of recursion usually when u know how many loops u had to use u must use iteration and when u dont know how many loops u need to use to find ur answer use recursion

good example is 3 sum combinations in this if u use recursion the complexity is 3^n but in iteration it is n^2 so in these cases recursion is avoided
Similar questions