Algorithm visualizer: watch the code run, step by step
Pick an algorithm and press ▶ to watch real code run line by line: how the variables, arrays and pointers change at each step. Each one in Python and in C.
▶ Start with bubble sortSorting and searching · arrays as bars
Bubble sortCompare neighbours, swap the bigger one rightO(n²)39 stepsBeginnerSelection sortPick the smallest each pass, put it in frontO(n²)39 stepsBeginnerInsertion sortLike sorting cards in your handO(n²)40 stepsBeginnerMerge sortSplit in half, sort, merge backO(n log n)106 stepsIntermediateQuick sortPick a pivot, smaller values go leftO(n log n)81 stepsIntermediateBinary searchHalve the range every stepO(log n)20 stepsBeginner
Linked lists, trees and graphs · pointers as arrows
Reverse a linked listThree pointers: prev, cur, nextO(n)53 stepsIntermediateBinary search treeSmaller on the left, bigger on the rightO(log n)116 stepsIntermediateBreadth-first search (BFS)Spread out ring by ringO(V + E)50 stepsIntermediateDepth-first search (DFS)Go deep first, then back upO(V + E)44 stepsIntermediate