Definition
Inorder traversal visits nodes in Left subtree -> Root -> Right subtree order.
Key Characteristics
- ✓Visits BST nodes in ascending order
- ✓Visit root after going all the way left
- ✓A form of DFS (Depth-First Search)
Use Cases
Used in these scenarios:
📈
BST Sorted Output
Print BST nodes in ascending order
🧮
Expression Tree Infix
Generate human-readable infix notation
🔍
Find k-th Smallest
Find k-th smallest value in BST efficiently
Complexity
Time Complexity
Best
O(N)
Average
O(N)
Worst
O(N)
Space Complexity
O(H)
Understand Deeper with Visualization
See how the algorithm works through step-by-step animations and code execution.
Start Visualization