TreesAnimated
Inorder Traversal
Left, node, right. On a BST this yields sorted order.
Time
O(n)
Extra space
O(h)
Use it for
Sorted output from a BST.
How it works
- Go left as far as possible.
- Visit the node.
- Then go right.
- On a binary search tree this visits the keys in ascending order.
Watch it run
Loading animation…