Study how classic algorithms like sorting and searching are implemented in C.
Learn data structures and mathematical concepts through working code examples.
Use reference implementations to understand algorithm logic before coding your own.
Port algorithms to embedded systems or microcontrollers with minimal dependencies.
TheAlgorithms/C is an open-source educational collection of algorithm implementations written in the C programming language. It covers a broad range of topics: sorting and searching, data structures, mathematics, statistics, machine learning concepts, physics simulations, and more, all coded up as individual, self-contained programs in C. The goal is learning. Each implementation is meant to illustrate how an algorithm works at a fundamental level, with well-documented source code that educators and students can read and study. Because each file only uses C's own built-in standard library and no third-party packages, there is nothing extra to install, the algorithms can be compiled and run on their own. This also makes it possible to use the code on embedded systems (small computing devices like microcontrollers) with minimal changes. You would use this repository when you are studying computer science concepts and want to see how a specific algorithm is actually coded in C, or when you want reference implementations to understand the logic before applying it elsewhere. It is not a production library, it is a study resource. The code adheres to the C11 standard (a version of C from 2011) and is tested on macOS and Linux. The project is community-driven: contributors add new algorithm implementations following contribution guidelines, and the documentation is auto-generated from the source code. The source code is licensed under GPLv3, and the documentation is licensed under Creative Commons BY-SA 4.0.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.