Pre-Order Traversal
overview
Remember these Terms
- Pre-order (NLR): Visit node, then left, then right.
- Tree: Hierarchical structure of connected nodes.
- Node: Holds a value and child links.
- Root: The topmost node in the tree.
- Left/Right child: Immediate descendants of a node.
- DFS: Depth-first family; pre-order is one.
- Recursion: Function calls itself to traverse.
- Stack: Stores nodes for iterative traversal.
- Visit/Process: Do work on the current node.
- Time/Space: O(n) time, O(h) extra space.
← Prev Topic
Slide 1 / 2
Next Topic: Balanced Tree →