TheAlgorithms/C logo

TheAlgorithms/C

Free

Collection of various algorithms in mathematics, machine learning, computer science, physics, etc implemented in C for educational purposes.

FreeFree tier
Type
Open Source

About TheAlgorithms/C

TheAlgorithms/C is an open-source repository (licensed under GPLv3) that provides a comprehensive collection of algorithm implementations in the C programming language. The algorithms span computer science, mathematics, statistics, data science, machine learning, engineering, and more. Each implementation is atomic, using only the standard C library (libc) with no external dependencies, ensuring portability and ease of study. The code adheres to the C11 standard, is well-documented with detailed explanations, and includes self-checks for correctness. The repository is actively tested on macOS and Ubuntu using AppleClang and GNU compilers. It serves as a learning resource for educators and students, offering multiple algorithm strategies for the same problem. Online documentation is generated directly from the source code, including code snippets, execution details, and diagrams.

Key Features

Open-source implementations under GPLv3 license
Well-documented source code with detailed explanations
Atomic code using only standard C library (libc), no external dependencies
Adherence to C11 standard for portability to embedded systems (ESP32, ARM Cortex)
Self-checks within programs for correctness
Compiled and tested on macOS and Ubuntu with latest compilers
Modular code design for reuse in other applications
Online documentation generated directly from repository source code
Covers a wide range of algorithms: data structures, sorting, searching, machine learning, dynamic programming, math, cryptography, and more

Pros & Cons

Pros
  • Free and open-source with permissive GPLv3 license
  • Extensive collection covering numerous algorithm categories
  • Well-documented code facilitates learning and understanding
  • Portable across platforms and embedded systems due to C11 standard and no external libs
  • Actively maintained with continuous testing on macOS and Ubuntu
  • Self-checking programs ensure implementation accuracy
Cons
  • Limited to the C language, not suitable for developers needing other language implementations
  • Primarily educational focus, may require adaptation for production use
  • No official support beyond community contributions
  • Some algorithm implementations may not be the most optimized for modern hardware

Best For

Educational resource for learning algorithm design and implementation in CReference for students and educators studying computer science and mathematicsExploring multiple algorithm strategies and optimizations for the same problemPorting algorithms to embedded systems with C11 complianceOpen-source base for building or extending algorithm libraries

FAQ

What is TheAlgorithms/C?
It is a collection of open-source implementations of various algorithms in C, intended for educational purposes. The algorithms cover topics from computer science, mathematics, machine learning, physics, and more.
Does the code require any external libraries?
No. Each source code is atomic and uses only the standard C library (libc). No external libraries are needed for compilation and execution.
Is the code portable to embedded systems?
Yes. The code adheres to the C11 standard, ensuring portability to embedded systems such as ESP32 and ARM Cortex with little to no modifications.
How is the code tested?
Source codes are compiled and tested for every commit on the latest versions of macOS (AppleClang 14.0.0) and Ubuntu (GNU 11.3.0).
What license is used?
The repository is licensed under the GPLv3 License.
Where can I find online documentation?
Online documentation is generated directly from the repository source code and includes code snippets, execution details, diagrams, and links to external resources.