Recursive to Iterative | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Recursive to Iterative

How to convert a recursive function into iterative?

5th Sep 2020, 2:53 AM
Mahesh Kantariya
2 Answers
0
Where’s your attempt?
5th Sep 2020, 2:57 AM
Rowsej
Rowsej - avatar
0
Take hofstadter's Q-sequence as example. Q(1)=q(2)=1 Q(n)=Q(n-Q(n-1))+Q(n-Q(n-2))
5th Sep 2020, 3:04 AM
Mahesh Kantariya