This repository contains implementations of various sorting strategies in C++.
To set up this project locally, follow these steps:
- Ensure you have CMake (version 3.29 or higher) and a C++20 compatible compiler installed.
To build the project, you can use the provided build script:
./scripts/build.shThis script will create a build directory, run CMake, and build the project.
To run the tests, use the provided test script:
./scripts/run_tests.shThis script will build the project and run all tests using CTest.
Note
Each sorting strategy is implemented as a separate class that inherits from a common Sort
interface, allowing for easy interchangeability and extension.
Bubble Sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted.
Quick Sort is a divide-and-conquer algorithm that works by selecting a 'pivot' element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot. The sub-arrays are then sorted recursively.
Merge Sort is also a divide-and-conquer algorithm. It divides the input array into two halves, recursively sorts them, and then merges the two sorted halves.