AlgoScope

Binary Search Tree

Data structurebeginnerTreesalso called BST

Smaller values sit left, larger sit right, so a search walks one path down.

Decision · step 2 of 6Binary Search Tree: Search for 45
203035404550✓607080current50 < 45

45 is smaller than 50: go left.

Open in the player →or start at step 2

What you will see

COMPARE at a node -> MOVE left or right -> INSERT at the empty spot.

How binary search tree works →

Cost

searchO(h)
insertO(h)
deleteO(h)
SpaceO(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.

Taught by the same lesson

Binary Search Tree covers these too, in the same run.