Diwali offer: Every paid guide and the Placement Kit are free. Till 8 Nov, 11:59 pm. After that, ₹49–₹299.

All 8 in one kit
All guides

Step 3 of 5: Pass the coding test

Recursion to Iteration: 8 Conversions, Python + Java

Free

No payment. Just your email.

  • 14 pages
  • 8 conversions
  • Call stack traced

About this guide

See the call stack drawn as frames, with a full push-and-pop trace of factorial(4), then turn eight classic recursive functions into loops: factorial, Fibonacci, sum of a list, reverse a string, binary search, tree in-order, level-order and grid flood fill. Every version is written in Python, run before it was printed, and mirrored in Java, with a page each on when not to convert, the real recursion limits in Python and Java, and the five mistakes that fail a submission. 14 pages, PDF.

What you download

  • Recursion_To_Iteration.pdf906 KB