Bifalgorithm post · Brisk · Chapter 1
What are the three ways to traverse a binary tree?
What are the three ways to traverse a binary tree? (Brisk · Chapter 1) — "There were two ways of traversing a graph: breadth-first, and depth-first. Curiously,…
Ideas in this flowchart
- Graph and tree traversal methods
- Graph traversal has two ways
- Breadth-first traversal
- Depth-first traversal
- Tree traversal has three ways
- Pre-order traversal
- Post-order traversal
- In-order traversal
- All three tree traversals begin at the root
- Each root child is considered a subtree
- The traversals differ in the order of visitation
- The first pre-order step is to visit the root
