Validate BST
Every node must sit inside a window inherited from all its ancestors, not just its parent.
Build and Validate a BST: Swap two values and catch it
50 must be between open and open. It is. Its left child may be anything from open to 50, its right from 50 to open.
Cost
- Best
- O(n)
- Average
- O(n)
- Worst
- O(n)
- Space
- O(h)
Before this
Leads to
Topics that need this one first.
Taught by the same lesson
Build and Validate a BST covers these too, in the same run.