Reusable implementations of core data structures and algorithms in modern C++, with small programs that exercise their trade-offs in practice.
This repository is organized around ideas rather than a course timeline. The public-facing code lives in include/, examples/, and tests/; the original exploratory material is kept in archive/ for reference.
- Manual memory ownership, destructors, explicit copy/move policies, and exception-safe resizing
- Singly and doubly linked lists, a dynamic array, and a circular-buffer deque
- Binary search trees and AVL trees with rotations, deletion, and traversals
- A vector-backed set and a separate-chaining hash set with rehashing
- Heap-based priority queues and generic insertion, merge, and quick sort
- Complexity analysis backed by a repeatable benchmark executable
- Testable, header-only components with a minimal CMake build
include/ds/ reusable data structures and algorithms
examples/ focused demos and performance experiments
tests/ executable smoke tests
docs/ design notes and complexity reference
archive/ original coursework and exploratory notes
cmake -S . -B build
cmake --build build
ctest --test-dir build --output-on-failure
./build/benchmark_sets
./build/priority_queue_demoThe library is header-only and requires C++17. No third-party dependencies are needed.
| Structure | Lookup | Insert | Remove | Notes |
|---|---|---|---|---|
DynamicArray |
O(1) by index | O(1) amortized | O(n) | contiguous storage |
SinglyLinkedList |
O(n) | O(1) at front | O(1) at front | one link per node |
DoublyLinkedList |
O(n) | O(1) at ends | O(1) at ends | bidirectional links |
BinarySearchTree |
O(h) | O(h) | O(h) | h can become n |
AvlTree |
O(log n) | O(log n) | O(log n) | rotations maintain balance |
HashSet |
O(1) average | O(1) average | O(1) average | separate chaining |
PriorityQueue |
O(1) max | O(log n) | O(log n) | binary max-heap |
For implementation details, see docs/design-notes.md.