Skip to content

pedroafonso18/SortingVisualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sorting Visualizer

A simple sorting algorithm visualizer built with C++ and raylib.

It renders a shuffled array as vertical bars and sorts them step-by-step in real time, so you can watch the algorithm work frame by frame.

Screenshot

Sorting Visualizer

Algorithm

Currently implements Bubble Sort, advancing one comparison per frame.

Controls

Key Action
Space Shuffle and restart
Esc / close window Quit

Building

Requires CMake 3.31+ and a C++ compiler. raylib is fetched automatically via CMake's FetchContent.

cmake -B build
cmake --build build
./build/SortingVisualizer

Configuration

Constants in include/globals.h:

Constant Default Description
NUMBER_COUNT 200 Number of elements / target FPS
SCREEN_WIDTH 800 Window width
SCREEN_HEIGHT 600 Window height
LINE_WIDTH 10 Width of each bar in pixels
LINE_HEIGHT_FACTOR 10 Multiplier for bar height

About

Do you know these sorting algorithm visualizers we see everywhere on instagram? I made my own.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors