An open API service indexing awesome lists of open source software.

https://github.com/brendanddev/struccs

A lightweight, generic C library of fundamental data structures. No dependencies, no standard container libraries.
https://github.com/brendanddev/struccs

algorithms data-structures memory-management

Last synced: 9 days ago
JSON representation

A lightweight, generic C library of fundamental data structures. No dependencies, no standard container libraries.

Awesome Lists containing this project

README

          

# struccs
A lightweight, generic C library of fundamental data structures built from scratch with a focus on memory management, performance, and type-agnostic design.

> Version 0.9.8

---

## Overview
A collection of generic, reusable data structures implemented in C using `void*` pointers,
function pointers, and manual memory management — no dependencies, no standard container
libraries.

---

## Structures
| Structure | Description |
|---|---|
| GenericArray | Type-agnostic dynamically resizing array |
| LinkedList | Doubly linked list with bidirectional traversal |
| Stack | LIFO structure backed by linked nodes |
| Queue | FIFO structure backed by linked nodes |
| HashTable | Generic hash table with separate chaining |
| BinarySearchTree | Generic BST with recursive operations |
| BinaryTree | Complete binary tree backed by flat array |
| Heap | Min/max heap |
| Set | In progres... |

---

## Project Structure

```
struccs/
├── include/ # Public headers
│ ├── generic_array.h
│ ├── linked_list.h
| ├── set.h
│ ├── stack.h
│ ├── queue.h
│ ├── hash_table.h
│ ├── binary_tree.h
│ ├── binarysearch_tree.h
│ └── heap.h
├── src/ # Implementations
│ ├── generic_array.c
│ ├── linked_list.c
│ ├── set.c
│ ├── stack.c
│ ├── queue.c
│ ├── hash_table.c
│ ├── binary_tree.c
│ ├── binarysearch_tree.c
│ └── heap.c
├── tests/ # Test suites
├── docs/ # Documentation
│ ├── USAGE.md
│ ├── API.md
│ └── PERFORMANCE.md
├── Makefile
├── LICENSE
└── README.md
```

---

## Building

Clone the repo and build the static library:

```bash
git clone https://github.com/brendanddev/struccs.git
cd struccs
make
```

This produces `build/libstruccs.a`.

To run a specific test:

```bash
make test_ga
make test_ll
make test_bt
# etc...
```

To run all tests:

```bash
make test_all
```

To clean build artifacts:

```bash
make clean
```

---

## Usage

Include the umbrella header to get everything:

```c
#include "struccs.h"
```

Or include individual headers:

```c
#include "generic_array.h"
#include "linked_list.h"
```

Link against the static library when compiling:

```bash
clang myprogram.c -I/path/to/struccs/include -L/path/to/struccs/build -lstruccs -o myprogram
```

See [docs/usage.md](docs/usage.md) for full code examples for each structure.

---

## Docs

- [Usage Examples](docs/USAGE.md)
- [API Reference](docs/API.md)
- [Performance](docs/PERFORMANCE.md)

---

## License

MIT License — see [LICENSE](LICENSE) for details.