Binary Search Tree
Smaller values sit left, larger sit right, so a search walks one path down.
Decision · step 2 of 6Binary Search Tree: Search for 45
45 is smaller than 50: go left.
What you will see
COMPARE at a node -> MOVE left or right -> INSERT at the empty spot.
Cost
| search | O(h) |
|---|---|
| insert | O(h) |
| delete | O(h) |
| Space | O(n) |
h is the height; O(log n) when balancedO(n) when degenerate.
How you work with it here
play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.
Screen readers: Each element is an accessibility element with position, value and state; structural changes are announced per step.
Reduced motion: Elements appear at their destination with a crossfade; no travel longer than the element's own size.
Before this
Leads to
Topics that need this one first.
Taught by the same lesson
Binary Search Tree covers these too, in the same run.