Skip to content

abidanBrito/sorting-visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sorting-visualizer

License: MIT C++20

Side-by-side visualization of six sorting algorithms running on the same random input.

screenshot

Bars are color-coded by state:

  • Pink - Current comparison.
  • Purple - Most recent swap or write.
  • Teal - In final sorted position.

Algorithms

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

Controls

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

Quick start

Requirements

  • CMake 3.20+.
  • A C++20 compiler.

Dependencies

  • raylib.
  • raygui.

Both are fetched automatically via FetchContent at configure time.

Build & run

Using the provided CMakePresets.json (recommended):

cmake --preset clang-debug
cmake --build --preset clang-debug
./bin/sorting-visualizer

Replace 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-visualizer

The first configure step downloads the dependencies, so it takes a bit longer than subsequent builds.

License

This repository is released under the MIT license. See LICENSE for more information.

About

Sorting algorithms visualizer.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors