DSA Workbench
watch · try · remember

DSA Workbench

Learn how computers sort things, search for things and find their way. Everything is explained in plain words, with pictures you can play with. No experience needed.

being compared swapping or moving pivot (the bar everyone is compared with) in the right place now

Think of guessing a number from 1 to 100. You always guess the middle, and the answer tells you which half to throw away.

Each guess cuts the pile in half, so 15 numbers need at most 4 guesses and a million numbers need at most 20. It only works when the numbers are lined up from small to big.

Speed
O(log n) · halves each guess
Extra room
O(1) · tiny
Needs
numbers in order

Tap or drag on the grid to build walls. The green square is where you start and the red square is the treasure. Press Play to watch the computer search for a way through.

squares already checked the way it found wall (blocked)