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.
- Opaque data types
- PIMPL design pattern
- C generics leveraging void pointers
- Checked with Google's Sanitizers
- Compliant with Google's C/C++ style
- Benchmarks versus the C++ STL
- 100% test coverage
Check the examples folder for more uses of libdsa.
#include <dsa.h>
int main() {
mytype m = { .a = 1, .b = "2" };
vector *v = vector_init(sizeof(mytype));
vector_push(v, &m);
vector_pop(v);
vector_free(v);
}
Install:
$ make release
$ make install
Include:
#include <dsa.h>
Compile your code with -ldsa
:
$ gcc yourcode.c -ldsa
- 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