Modern, self-contained implementations of classic algorithms and data structures in C++17. Code is organized by topic and builds with CMake on Windows, macOS, and Linux. Licensed under the MIT License.
- C++17 throughout, using the Standard Library only (no third-party deps by default)
- One executable per example/source file for easy exploration
- Optional OpenMP for multithreading where applicable
- Optional OpenGL/GLUT for graphics samples (auto-downloads FreeGLUT if needed)
- Optional Doxygen docs generated directly from source
Top-level folders group related algorithms. Examples include:
backtracking/– N-Queens, Sudoku solver, graph coloring, subset sum, etc.bit_manipulation/– bit tricks, Gray code, Hamming distance, power of 2, etc.ciphers/– Caesar, Vigenère, Hill, Atbash, Base64, XOR, ECC key exchangecpu_scheduling_algorithms/– FCFS, SJF, and related scheduling examplesdata_structures/– BST, AVL, RB-tree, heaps, queues, stacks, skip lists, DSU, segment/sparse tablesdivide_and_conquer/,dynamic_programming/,graph/,greedy_algorithms/,search/,sorting/,strings/, and moregraphics/– OpenGL/GLUT-based visual demos when OpenGL is availabledoc/– Doxygen configuration
Each subdirectory contains a CMakeLists.txt that turns every *.cpp into an executable target.
- CMake 3.22+
- A C++17 compiler
- Windows: MSVC 2022 (preferred) or MinGW-w64
- Linux: GCC or Clang
- macOS: AppleClang
- Optional: OpenMP (set via
-DUSE_OPENMP=ON, enabled by default) - Optional: Doxygen 1.9+ to build documentation
- Optional: OpenGL + GLUT for
graphics/(FreeGLUT will be auto-fetched if GLUT is not found)
Build all executables with Visual Studio generator:
mkdir build; cmake -S . -B build -G "Visual Studio 17 2022" -A x64 -DUSE_OPENMP=ON; cmake --build build --config ReleaseInstall to a local prefix (puts executables under out/bin/<category>):
cmake --install build --config Release --prefix .\outRun an example (after install):
.\out\bin\backtracking\generate_parentheses.exeTip: list available targets:
cmake --build build --target helpBuild a single target only:
cmake --build build --target generate_parentheses --config ReleaseMinGW (alternative):
cmake -S . -B build -G "MinGW Makefiles" -DUSE_OPENMP=ON; cmake --build build -jIf Doxygen is installed, you can build the docs target:
cmake --build build --target docOpen build/doc/html/index.html in your browser.
This repository includes .clang-format and .clang-tidy. Please run formatting and address warnings before submitting changes.
Distributed under the MIT License. See LICENSE for details.
This project follows the structure of, and includes implementations inspired by, TheAlgorithms/C-Plus-Plus. Thanks to all contributors to the broader open-source algorithms community.