Visualisation of some popular sorting algorithms using openGL framework.
Sorting a sequence of items is one of the pillar of Computer Science. A sorting algorithm is an algorithm that organizes elements of a sequence in a certain order. Since the early days of computing, the sorting problem has been one of the main battlefields for researchers. The reason behind this is not only the need of solving a very common task but also the challenge of solving a complex problem in the most efficient way.
This project is an attempt to visualize and help to understand how some of the most famous sorting algorithms work. This project provides two standpoints to look at algorithms, one is more artistic (apologies to any real artist out there), the other is more analytical aiming at explaining algorithm step by step.
This project does not want to teach the theory of sorting algorithms, there are amazing resources, books and courses for this purpose. Sorting Visualizer program is for the ones who want to see these algorithms under a different light and theme and hopefully appreciate the processing and brain power behind these piece of genius that in many ways have changed the way we live.
- Provides random theme for every run
- Two modes for interaction
- Keyboard interface
Using this mode you can watch each swap of variables with interaction.
Press s
to go to next swap.
This mode will run the selected algorithm with predefined constant speed.
- To start the sorting press
s
- To pause the soritng press
p
- To randamize the inputs press
r
- To change\select the algorithm press
c
- To set interactive mode press
i
- To set outstanding mode press
o
- To set new random color press
z
which also randomize the inputs - Press
<ESC>
key to terminate the application
-
Bubble Sort
-
Selection Sort
-
Insertion Srot
-
Ripple Sort (Another version of Bubble sort)
-
Comb Sort (Another version of Bubble sort)
# Clone this repository
$ git clone https://github.com/rustiever/SortingAlgorthimsVisualizer.git
# Go into the repository
$ cd SortingAlgorthimsVisualizer
$ g++ -framework OpenGL -framework GLUT visualizer.cpp -o visualizer -Wno-deprecated
$ g++ visualizer.cpp -lGL -lGLU -lglut
$ ./visualizer
Built and Tested on Mac OS ✅👍🏻
Made with ❤️ and C++.