Skip to main content

Recursive Traversal

Learn Recursive Traversal (Trees, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Why Recursion is the Default for Tree Traversal The call stack IMPLICITLY tracks "where to return to" after finishing a subtree - exactly the bookkeeping an iterative version would otherwise need an explicit stack for. This is why recursive tree code is almost always shorter and more directly mirrors the traversal's definition.

More lessons in Trees