Skip to content

harshtiwari2022/sorting_visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📊 Sorting Visualizer (C++)

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).


✨ Features

  • 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)

control

-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

Install SFML (2.5+)

Configure with RENDERER=SFML

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

Screenshot 2025-05-13 194907 Screenshot 2025-06-30 201217

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages