Side-by-side visualization of six sorting algorithms running on the same random input.
Bars are color-coded by state:
- Pink - Current comparison.
- Purple - Most recent swap or write.
- Teal - In final sorted position.
- Bubble sort.
- Selection sort
- Insertion sort.
- Merge sort (iterative, bottom-up).
- Quick sort (Lomuto's partitioning scheme).
- Cycle sort.
Each algorithm advances one comparison/swap/write per visualization step, so the step counts reflect comparable units of work across the panes.
- Play/pause button - Toggle animation playback.
- Reset button - Restore the original random input across all panes.
- Per-pane speed multiplier dropdown - 1x, 5x, 10x or 100x steps per frame.
- CMake 3.20+.
- A C++20 compiler.
- raylib.
- raygui.
Both are fetched automatically via FetchContent at configure time.
Using the provided CMakePresets.json (recommended):
cmake --preset clang-debug
cmake --build --preset clang-debug
./bin/sorting-visualizerReplace clang-debug with any other preset defined in CMakePresets.json (e.g. clang-release).
Or without presets:
cmake -B build
cmake --build build
./bin/sorting-visualizerThe first configure step downloads the dependencies, so it takes a bit longer than subsequent builds.
This repository is released under the MIT license. See LICENSE for more information.
