CPU调度算法(CPU Scheduling Algorithms)、位操作(Bit Manipulation)、回溯(Backtracking)算法等C++版算法实现。涵盖了计算机科学、数学和统计、数据科学、机器学习、工程等领域的各种主题。

David Leal 0934ec4a8a feat: label PR on CI fail (WIP) (#2455) 1 week ago
.github 0934ec4a8a feat: label PR on CI fail (WIP) (#2455) 1 week ago
.vscode 0c08cd75f9 feat: Created composite Simpson's numerical integration method (#1773) 1 year ago
backtracking 6027480643 feat: add well-formed parentheses generator (#2445) 1 week ago
bit_manipulation cc33efd3b6 [fix/feat]: remove memory leak in `avltree.cpp` (#2429) 3 months ago
ciphers e64e3df18f fix: CodeQL warnings (#1827) 1 year ago
cpu_scheduling_algorithms 95ed72a452 feat: Added implementation of FCFS CPU scheduling algorithm (#1684) 1 year ago
data_structures 1a1570d775 feat: Segment Tree Data Structure (#2444) 4 weeks ago
divide_and_conquer 5b238724b8 feat: add Strassen's Matrix Multiplication (#2413) 4 months ago
doc aaa08b0150 Major rework to improve code quality and add automation checks (#805) 2 years ago
dynamic_programming 4f4585d4c1 docs: improve `longest_palindromic_subsequence.cpp` (#2467) 1 week ago
geometry ea76786f12 feat: Added Graham Scan Algorithm. (#1836) 1 year ago
graph 8a6f2052e2 feat: Created midpoint integration numerical method (#1785) 1 year ago
graphics b89d1da2f1 chore: update FreeGLUT to v3.2.2 (#2432) 3 months ago
greedy_algorithms 5b238724b8 feat: add Strassen's Matrix Multiplication (#2413) 4 months ago
hashing 5245b3e4a9 feat. Add SHA-1 hashing algorithm (#1609) 1 year ago
machine_learning a8af29bf65 feat: add k-nearest neighbors algorithm (#2416) 3 months ago
math 4b740d464c fix: fit euler's totient to the contribution guidelines (#2447) 4 weeks ago
numerical_methods 2a076c1b03 feat: move `gram_schmidt` to `numerical_methods` (#1940) 11 months ago
operations_on_datastructures 1f0eff28d0 fix: Circular linked list (#1825) 1 year ago
others 34720ae2d3 fix: stairs pattern not printing slash (#2111) 6 months ago
physics 0fea073413 feat: added physics directory and ground to ground projectile motion algorithm (#2279) 7 months ago
probability 85721be69b feat: Modify search/text_search.cpp (#1662) 1 year ago
range_queries 5b238724b8 feat: add Strassen's Matrix Multiplication (#2413) 4 months ago
search 1645cf281f feat: add new Median Search implementation (#1992) 8 months ago
sorting 29f54393f3 feat: add Stooge sort algorithm (#2440) 1 month ago
strings e6b17203c7 feat: add binary_insertion_sort (#1850) 1 year ago
.clang-format c4f586b6ab [bug fix] fix code formatting in CI (#1052) 2 years ago
.clang-tidy b4bbe9dc4e [code fix] Fixed trie_tree for code quality and docs & clang-tidy error check (#1059) 2 years ago
.gitignore aaa08b0150 Major rework to improve code quality and add automation checks (#805) 2 years ago
.gitpod.dockerfile 5282286408 install freeglut3-dev (#973) 2 years ago
.gitpod.yml 5bfc7740c8 fix: remove the `ms-vscode.cpptools` extension 1 year ago
CMakeLists.txt 3b4d1421d3 feat: add CMakeLists to the `divide_and_conquer` directory (#2072) 7 months ago
CODE_OF_CONDUCT.md 1e8376eedb fix: Update the CoC to match the `.github` repository (#1832) 1 year ago
CONTRIBUTING.md c0c27153cd fix: self-test example not working 1 month ago
CodingGuidelines.md 0c5c096991 [feat/fix]: Improve the contributing guidelines... (#1522) 1 year ago
DIRECTORY.md 6027480643 feat: add well-formed parentheses generator (#2445) 1 week ago
LICENSE c5a89b9f94 chore: update copyright notices to 2022 8 months ago
README.md eb8bb3c4ee chore: fix CodeQL badge 1 month ago
REVIEWER_CODE.md 79b98cc905 feat: guidelines for reviewers (#1302) 2 years ago


The Algorithms - C++ # {#mainpage}

Gitpod Ready-to-Code CodeQL CI Gitter chat contributions welcome GitHub repo size Doxygen CI Awesome CI Income Discord chat Donate


This repository is a collection of open-source implementation of a variety of algorithms implemented in C++ and licensed under MIT License. These algorithms span a variety of topics from computer science, mathematics and statistics, data science, machine learning, engineering, etc.. The implementations and the associated documentation are meant to provide a learning resource for educators and students. Hence, one may find more than one implementation for the same objective but using a different algorithm strategies and optimizations.


  • The repository provides implementations of various algorithms in one of the most fundamental general purpose languages - C++.
  • Well documented source code with detailed explanations provide a valuable resource for educators and students alike.
  • Each source code is atomic using STL classes and no external libraries are required for their compilation and execution. Thus, the fundamentals of the algorithms can be studied in much depth.
  • Source codes are compiled and tested for every commit on the latest versions of three major operating systems viz., Windows, MacOS and Ubuntu (Linux) using MSVC 16 2019, AppleClang 11.0 and GNU 7.5.0 respectively.
  • Strict adherence to C++11 standard ensures portability of code to embedded systems as well like ESP32, ARM Cortex, etc. with little to no changes.
  • Self-checks within programs ensure correct implementations with confidence.
  • Modular implementations and OpenSource licensing enable the functions to be utilized conveniently in other applications.


Online Documentation is generated from the repository source codes directly. The documentation contains all resources including source code snippets, details on execution of the programs, diagrammatic representation of program flow, and links to external resources where necessary. The documentation also introduces interactive source code with links to documentation for C++ STL library functions used. Click on Files menu to see the list of all the files documented with the code.

Documentation of Algorithms in C++ by The Algorithms Contributors is licensed under CC BY-SA 4.0
Creative Commons LicenseCredit must be given to the creatorAdaptations must be shared under the same terms


As a community developed and maintained repository, we welcome new un-plagiarized quality contributions. Please read our Contribution Guidelines.