mirror of
https://github.com/bkthomps/Containers.git
synced 2025-11-16 12:34:47 +00:00
e2d596e4bd5bcf1c870c0631ac6d68d6a6dbead7
Refactor tests in order for the component or logic that they are testing to be contained into individual sub-tests instead of all tests being contained in one big test for the whole data structure. Add testing for out-of-memory (OOM) conditions. This makes the source code now 100% covered. Bug fix! A bug has been identified and fixed in the list data structure in the list_add_last function. This bug would occur when adding an item to the back of the list because the pointers were not being updated properly. Minor Bug fix! A bug has been identified and fixed in the unordered_set, unordered_map, unordered_multiset, and unordered_multimap data structures in their respective unordered_xxx_put functions. This bug would occur in an out-of-memory condition, which would cause the size of the collection to increase without actually adding the new element to it.
Containers
This library provides various containers. Each container has utility functions to manipulate the data it holds. This is an abstraction as to not have to manually manage and reallocate memory.
Inspired by the C++ standard library; however, implemented using C with different function interfaces as the C++ standard library but with the same container names.
Sequence containers
Data structures which can be accessed sequentially.
- array - static contiguous array
- vector - dynamic contiguous array
- deque - double-ended queue
- forward_list - singly-linked list
- list - doubly-linked list
Associative containers
Data structures that can be quickly searched which use comparators.
- set - collection of unique keys, sorted by keys
- map - collection of key-value pairs, sorted by keys, keys are unique
- multiset - collection of keys, sorted by keys
- multimap - collection of key-value pairs, sorted by keys
Unordered associative containers
Data structures that can be quickly searched which use hashing.
- unordered_set - collection of unique keys, hashed by keys
- unordered_map - collection of key-value pairs, hashed by keys, keys are unique
- unordered_multiset - collection of keys, hashed by keys
- unordered_multimap - collection of key-value pairs, hashed by keys
Container adaptors
Data structures which adapt other containers to enhance functionality.
- stack - adapts a container to provide stack (last-in first-out)
- queue - adapts a container to provide queue (first-in first-out)
- priority_queue - adapts a container to provide priority queue
Description
This library provides various containers. Each container has utility functions to manipulate the data it holds. This is an abstraction as to not have to manually manage and reallocate memory.
arrayavl-treecollectioncollectionscontainercontainersdata-structuresdatastructuresdequehash-maphash-setlistmappriority-queuequeuesetstacktreetree-structurevector
Readme
MIT
1.2 MiB
Languages
C
99.5%
Python
0.3%
Makefile
0.2%