zsmb's prog site

Sort Visualizer

  2015.06.30.

Introduction

This is a C++/SDL2 project for visualizing how certain sort algorithms work. Inspired by - for example -  this video, but really these things are just everywhere. Seemed like a fun thing to make, so here it is.

Description

My implementation has 5 sort algorithms in it so far: selection sort, bubble sort, gnome sort, bogo sort, and heap sort. The source for the first three sort algorithms is  this site (yes, I'm that lazy) and  this site is where I found the heap sort (a friend's favourite). The very complicated bogo sort I wrote myself.

Please note that the runtime of these algorithms is by no means comparable, the timings for the built in delays have been adjusted so that the sorts run for roughly the same time (should be around 20-30 seconds for all of them in most cases).

The controls for the program are very basic, you can see them on the bottom when launching it. Number keys to scramble the array and start a sort, space to cancel a sort, escape to quit.

I might add some more sorts to this thing in the future sometime, but this is it for now. Enjoy!

For further reading, you can check out a related blog post  here.

Downloads

Downloading the zip file that contains the executable results in a warning (at least in Chrome) as a security measure, but you can choose to "Keep" it.

You can also find this project on GitHub (the Windows version, that is)  here.

Name Description Size Date
sortvisualizer.cpp Source code 13 KB 2015.06.30.
sortvisualizer.zip Windows executable with dll's 835 KB 2015.06.30.
sortvisualizer.tar.gz Linux project with Makefile and SDL_gfx 37 KB 2015.06.30.