Skip to content

The Algorithms - C++

A large collection of algorithms implemented in C++ for learning.TheAlgorithms/C-Plus-Plus

Stars
34.8k
Forks
7.9k
Licence
MIT
Language
C++
Last update
1 months ago
Type
Learning resource

What it is

This is a repository of algorithm implementations written in C++, covering topics such as computer science, mathematics, statistics, data science, machine learning, and engineering. The code and its documentation are meant for educators and students who want to study how algorithms work. Several implementations of the same problem may appear, each using a different strategy or optimization.

  • Read the source and documentation for a specific algorithm such as a sort or search
  • Compare different implementations of the same problem to see how strategies differ
  • Compile and run individual programs to observe their output
  • Browse the online documentation, which includes program flow diagrams and links to STL references

Great for

  • Students learning algorithms and data structures in C++
  • Educators looking for example implementations to teach from
  • Developers preparing for technical interviews or competitive programming
  • Programmers who want to see a standard-library-only C++17 reference implementation

Not ideal for

  • Anyone needing a production library to call from an application, since the README frames the code as educational
  • Readers who do not know C++, because the code and explanations assume it
  • People looking for a packaged tool with an installer or release versions, since the README mentions no releases
Step-by-step guide: how to use The Algorithms - C++Install, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: A C++17-capable compiler

    Clone the repository

    git clone https://github.com/TheAlgorithms/C-Plus-Plus
  2. 2

    Run it

    • Clone the repository with git.
    • Open the online documentation at https://TheAlgorithms.github.io/C-Plus-Plus to find an algorithm.
    • Compile the chosen source file with a C++17 compiler.
    • Run the program and check its self-checks and output.
  3. 3

    Get the most out of it

    • Use the online documentation, which includes source snippets, execution details, and program flow diagrams.
    • Use the Files menu in the documentation to browse every documented file.
    • Compare multiple implementations of the same objective to see different strategies and optimizations.
    • Read the contribution guidelines if you want to add or improve an implementation.

Downloads

Strengths

  • Code uses STL classes with no external libraries, which keeps each example self-contained
  • The README states that code is compiled and tested on Windows, macOS, and Ubuntu on every commit
  • Licensed under MIT, and the documentation is published under CC BY-SA 4.0

Trade-offs

  • The README does not describe a single entry point or how to pick the right file for a given need
  • Because it is community-maintained, the README does not guarantee every implementation has the same level of detail

How it compares

ProjectStarsTypeLevelUpdatedBest for
C-Plus-Plus (this)34.8kLearning resourceintermediate1 months agoStudents learning algorithms and data structures in C++
Python226kLearning resourcebeginner17 days agoStudents learning algorithms and data structures
Java66.7kLearning resourcebeginner4 days agoStudents learning algorithms and data structures in Java
interviews65.5kLearning resourcebeginner1.5 years agoStudents preparing for their first software engineering interviews
Go18.2kLearning resourcebeginner3 months agoBeginners learning Go who want to read working implementations of common algorithms
javascript-algorithms197kLearning resourcebeginner3 months agoStudents learning core computer science concepts in JavaScript

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.