Algorithm visual lab
Control each operation, change inputs, and watch invariants develop across sorting, searching, stacks, queues, trees, and graphs.
Sorting
Bubble, selection, and insertion sort with comparisons, writes, and adjustable playback.
Initial unsorted array
Step 1/33 · 0 comparisons · 0 writes
Bubble sort
Adjacent inversions disappear; after each pass, the largest remaining value is fixed.
Selection sort
The prefix is final; each pass selects its next minimum from the suffix.
Insertion sort
The prefix is sorted; the current key is inserted without disturbing that invariant.
Searching
Compare a sequential scan with logarithmic range elimination.
Binary search automatically sorts custom input because sorted order is its core precondition.
25 < 42; discard indices 0–4
Step 1/4 · 1 comparison · active range [0, 9]
Stacks & queues
Perform operations and see LIFO and FIFO boundaries move.
Ready for an operation
size = 3Tree traversals
Switch between preorder, inorder, postorder, and level order.
Change the order and watch when each node is processed.
Process node 4 · 1 of 7
Graph traversals
Inspect how BFS uses a queue while DFS uses a stack.
Both start at A; neighbour order is alphabetical.
Visited
A
Queue · front → rear
B · C
Visit A; add B, C to the queue