AlexandruIca / SortVisualiser

Made after spending too much time on youtube

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StaticAnalysis CodeCoverage codecov

SortVisualiser

A project made for educational purposes(for myself).

Examples

Count Sort Bubble Sort Insertion Sort Radix Sort QuickSort Merge Sort

How to build

First of all, you should have conan and CMake installed. After that it's pretty simple:

mkdir build && cd build
conan install ..
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
cd src/
# Now you can run ./SortVisualiser

However, from personal experience, on Linux conan's SDL2 doesn't want to play audio, so you might build SDL2 from source. To do that, remove FindSDL2.cmake from your build dir and tell CMake where SDL2 is:

# Same as before
rm FindSDL2.cmake
SDL2_DIR=${SDL2_PATH} cmake -DCMAKE_BUILD_TYPE=Release ..
# Same as before

Where SDL2_PATH is the path where your build of SDL2 is located, more specifically the folder where sdl2-config.cmake is found.

To build for development:

cmake -DENABLE_SANITIZER_ADDRESS=ON \
      -DENABLE_SANITIZER_UNDEFINED=ON \
      -DBUILD_TESTS=ON \
      ..

How to use

You can ./SortVisualiser --help to see what the flags are. For example, to recreate the examples shown in this readme(in order):

./SortVisualiser --algorithm=count_sort --size=50
./SortVisualiser
./SortVisualiser --algorithm=insertion_sort
./SortVisualiser --algorithm=radix_sort_simple --size=100
./SortVisualiser --algorithm=quicksort --size=100 --color=blue
./SortVisualiser --algorithm=merge_sort --size=100 --color=white --highlight-color=red --type=point

Of course, to see the full set of options, the easiest way is to just check main.cpp.

About

Made after spending too much time on youtube

License:The Unlicense


Languages

Language:C++ 68.6%Language:Python 22.2%Language:CMake 8.5%Language:Shell 0.7%