Visualization of different sorting algorithms in C++ with SDL2 Library.
A sorting algorithm is an algorithm that puts the elements of a list in a certain order. While there are a large number of sorting algorithms, in practical implementations a few algorithms predominate. In this implementation of sorting visualizer, we'll be looking at some of these sorting algorithms and visually comprehend their working. The sorting algorithms covered here are Selection Sort, Insertion Sort, Bubble Sort, Merge Sort, Quick Sort and Heap Sort. The list size is fixed to 130 elements. You can randomize the list and select any type of sorting algorithm to call on the list from the given options. Here, all sorting algorithms will sort the elements in ascending order. The sorting time being visualized for an algorithm is not exactly same as their actual time complexities. The relatively faster algorithms like Merge Sort, etc. have been delayed so that they could be properly visualized.
You cab run Sorting Visualizer using the C++ source code available in the repository i.e., mian.cpp but you will need to install and setup the SDL2 library first. I recommend you follow Lazy Foo' Productions' tutorial to setup SDL2 Library and also HerbGlitch simple sdl2 set-up.
links:
How to download and setup SDL2 library Lazy Foo'.
How to download and setup SDL2 library HerbGlitch.
After setting up the SDL2 library, just include the main.cpp file from the repository in your project with the build options as mentioned in the tutorial and build and run the project.