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. The C standard library provides macros, type definitions and functions for tasks such as string handling, mathematical computations, input/output processing, memory management, and several other operating system services.
Implementation of Collections in C Language
- ArrayList: Automatically resizing array.
- Doubly linked list: A set of values stored in a list with links that point in both directions.
- Singly linked list: A set of values stored in a list with links that point in one direction.
- Queue: Double ended queue which can be used as a FIFO or a stack.
- Set: Unordered set of values.
- Bloom Filter: Space-efficient set.
Implementation of Mappings
- Hash table: Collection of values which can be addressed using a key.
- Trie: Fast mapping using strings as keys.
Binary Search Trees in C
- AVL tree: Balanced binary search tree with O(log n) worst case performance.
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.
- Integer comparison and hash functions.
- String comparison and hash functions.
- 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.