The C programming language includes a very limited number of standard libraries or common data structures and algorithms in comparison to other modern programming languages such as Java, C# or Python. This is a collection of common algorithm and data structure implementation in C which may be used in C projects.

The library includes the following data structures and utility functions.


  1. ArrayList: Automatically resizing array.
  2. Doubly linked list: A set of values stored in a list with links that point in both directions.
  3. Singly linked list: A set of values stored in a list with links that point in one direction.
  4. Queue: Double ended queue which can be used as a FIFO or a stack.
  5. Set: Unordered set of values.
  6. Bloom Filter: Space-efficient set.


  1. Hash table: Collection of values which can be addressed using a key.
  2. Trie: Fast mapping using strings as keys.

Binary search trees

  1. AVL tree: Balanced binary search tree with O(log n) worst case performance.

Utility functions

All of the above data structures operate on void pointers. It is sometimes necessary to compare values (when sorting a list, for example) or generate a hash key (in a hash table or set). This is done by providing a pointer to a function which provides this functionality. The following functions provide this functionality for some common data types.

  1. Integer comparison and hash functions.
  2. String comparison and hash functions.
  3. Generic (void) pointer comparison and hash functions.

The code is licensed under the ISC license (a simplified version of the BSD license that is functionally identical). As such, it may legitimately be reused in any project, whether Proprietary or Open Source.

C Algorithms