Binary Search Tree
Ordering invariant: left is smaller, right is larger. In-order traversal yields sorted output.
Newinterview weight 6515 problems2 visualisers
18
mastery
Attempts logged
0
Predicted success on the next one
33%
Solved here
0 / 15
What you actually need to hold in your head
- Search, insert and delete in O(h)
- In-order gives a sorted sequence
- Validate with min and max bounds, not just children
- Balance is what keeps the height logarithmic
Comfortable with these first
Next in the path
Heap / Priority Queue
Watch it run
Step through the algorithm before you write it.
BST Insert & SearchM
Left is smaller, right is larger. That one rule turns search, insert and delete into a single walk down the tree.
O(h), which is O(log n) when balanced
Validate a BSTM
Checking a node against its direct children is not enough. Pass an allowed range down the tree and narrow it at each step.
O(n)
Patterns in this topic
The trigger phrases are what you are training yourself to notice.
Binary Search Tree problems
Ordered by sheet phase, so the early ones are the highest signal.
0 / 15 solved