Data Structures & Algorithms library written in C99. Educational, single-header, and dependency-free.
| Module | Description |
|---|---|
src/sllist |
Singly linked list (sll_-prefixed API) |
src/dllist |
Doubly linked list (dll_-prefixed API) |
src/stack |
LIFO stack built on dllist |
src/queue |
FIFO queue built on dllist |
src/hashmap |
String-keyed hash map, DJB2 hash + separate chaining |
src/graph |
Directed weighted graph (BFS path_exists, connectivity) |
src/trees |
Binary tree (btree_) + n-ary tree (tree_), pre/in/post-order |
Use make to compile the library and demo.
makesrc/main.c is a small demo that exercises every structure.
Each module lives in its own folder and exposes its types in the matching header.
Structures store void * payloads; ownership of the payloads stays with the caller
(only the container's nodes are freed).
Lists accept indices 0..size for insertion and 0..size-1 for removal.
Every allocator failure is handled and reported; empty-pop/peek and empty-dequeue
return NULL.
Everything created with create_* must be released with free_* (e.g. free_sllist).
GPL-3.0. See LICENSE.