An interactive sorting algorithm visualizer written in C++.
Visualizes how classic sorting algorithms transform an array step-by-step.
Supports terminal (ASCII bars) out of the box. You can also enable a graphical build with SFML (optional).
- Visualize popular algorithms:
- Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, Quick Sort, Heap Sort
- Step-by-step rendering with adjustable delay
- Random / nearly-sorted / reversed input generation
- Counts comparisons and swaps
- Pause/Resume and Step-Through (terminal key input)
- Cross-platform (Linux, macOS, Windows)
-WARNING: Giving repetitive commands may cause latency and the visualizer may behave unexpectedly. Please give a new command only after the current command's execution is done
-Available Controls inside Sorting Visualizer
-Use 0 to Generate a different randomized list
-Use 1 to start Selection Sort Algorithm
-Use 2 to start Insertion Sort Algorithm.
-Use 3 to start Bubble Sort Algorithm.
-Use 4 to start Merge Sort Algorithm.
-Use 5 to start Quick Sort Algorithm.
-Use 6 to start Heap Sort Algorithm.
-Use q to exit out of Sorting Visualizer
cmake -B build -DCMAKE_BUILD_TYPE=Release -DRENDERER=SFML cmake --build build
./build/sorting_visualizer --algo heap --size 120 --delay 5
###🧪 Correctness & Stability
All algorithms are tested against a reference std::is_sorted check after completion.
Edge cases handled: size = 0/1, duplicate values, already sorted inputs.
###📸 Screenshots / GIFs