Every algorithm with a live animated visualization and clean, copy-paste reference code in Python, JavaScript, TypeScript, Java, Kotlin, C#, C++, C, Go, Rust, Swift, Ruby, PHP, Bash. Watch how each one works step by step, then grab the implementation for your language. Free, runs in your browser, no sign-up.
Repeatedly swaps adjacent out-of-order elements until the list is sorted.
Selects the smallest remaining element and moves it to the front.
Inserts each element into its correct place among the already-sorted items.
Splits the array, sorts each half, then merges the sorted halves.
Partitions around a pivot, then recurses on each side.
Builds a max-heap, then repeatedly extracts the maximum.
Counts occurrences of each value, then places them in order.
Sorts digit by digit using a stable counting pass per digit.
Explores a graph level by level using a queue.
Explores as far as possible down each branch before backtracking.
Finds shortest paths from a source by always expanding the closest node.
More categories — dynamic programming, trees, and strings — are being added. Have a request? Let us know.