https://github.com/joao-conde/libdsa
C data structures and algorithms library
https://github.com/joao-conde/libdsa
algorithms c data-structures
Last synced: about 1 month ago
JSON representation
C data structures and algorithms library
- Host: GitHub
- URL: https://github.com/joao-conde/libdsa
- Owner: joao-conde
- License: mit
- Created: 2022-11-05T23:11:38.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-06-27T16:40:13.000Z (over 2 years ago)
- Last Synced: 2025-05-05T05:35:27.998Z (5 months ago)
- Topics: algorithms, c, data-structures
- Language: C
- Homepage:
- Size: 318 KB
- Stars: 15
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# libdsa
**C data structures** and **algorithms** library.
A personal endeavor to **learn the inner workings** of different **data structures** and **algorithms**.
This library has been written for educational purposes. Consider using production-ready template container libraries focused on performance as opposed to readability.
## Features
- **Opaque data types**
- **PIMPL** design pattern
- **C generics** leveraging **void pointers**
- Checked with [Google's Sanitizers](https://github.com/google/sanitizers)
- Compliant with [Google's C/C++ style](https://github.com/cpplint/cpplint)
- Benchmarks versus the C++ STL
- 100% test coverage## Examples
Check the [examples folder](./examples) for more uses of libdsa.
```c
#includeint main() {
mytype m = { .a = 1, .b = "2" };
vector *v = vector_init(sizeof(mytype));
vector_push(v, &m);
vector_pop(v);
vector_free(v);
}
```## Usage
Install:
```bash
$ make release
$ make install
```Include:
```c
#include
```Compile your code with `-ldsa`:
```bash
$ gcc yourcode.c -ldsa
```## References
- deque: https://en.cppreference.com/w/cpp/container/deque
- heap: https://en.cppreference.com/w/cpp/algorithm/make_heap, https://en.cppreference.com/w/cpp/algorithm/push_heap, https://en.cppreference.com/w/cpp/algorithm/pop_heap
- list: https://en.cppreference.com/w/cpp/container/list
- map: https://en.cppreference.com/w/cpp/container/unordered_map
- pair: https://en.cppreference.com/w/cpp/utility/pair
- queue: https://en.cppreference.com/w/cpp/container/queue
- set: https://en.cppreference.com/w/cpp/container/unordered_set
- stack: https://en.cppreference.com/w/cpp/container/stack
- vector: https://en.cppreference.com/w/cpp/container/vector