Iterative Solution of Recursive Problems

Learn how a typically recursive algorithm can be implemented in an iterative way.

Motivation for recursion

Some problems, such as tree traversals or the Tower of Hanoi, are inherently recursive. Of course, the same problems can be solved in an iterative way with the help of data structures. If we compare the lines of code, we see that recursion takes less code and looks cleaner.

Get hands-on with 1200+ tech skills courses.