How to Traverse a Tree in Python

Stephen Castle

May 07, 2020

Facebook Icon
Twitter Icon

I walk through the process of traversing a binary tree data type in Python. Covers the difference between Preorder Traversal, In-order Traversal, and Post Order Traversal. I tried to make the example as simple as possible to focus on the core mechanic of recursion at play. This pattern is used as a building block for many more complicated algorithms.