C++ implementations of data structures, algorithms and useful designs.
Linux | Windows | Coverage |
---|---|---|
Name | Source | Benchmarked | Note | Definition |
---|---|---|---|---|
DoublyLinkedList | Tests .h |
Yes | A linked data structure that consists of a set of sequentially linked records. It also supports merge sort. | Wikipedia |
BinaryHeap | Tests .h |
Yes | A heap data structure taking the form of a complete binary tree. A common way of implementing priority queue. | Wikipedia |
HashTable | Tests .h |
No | A data structure that stores unique elements in no particular order, and which allows for fast retrieval of individual elements based on their values. Similar to std::unordered_set. | Wikipedia |
AVLTree | Tests .h |
Yes | A self-balancing binary search tree. | Wikipedia |
Graph | Tests .h |
No | A data structure to implement the directed/undirected graph concepts from mathematics. It stores a graph in an adjacency list or matrix. | Wikipedia |
Name | Source | Benchmarked | Note | Definition |
---|---|---|---|---|
MD5 | Tests .h |
Yes | A widely used hash function producing a 128-bit hash value. | Wikipedia |
NPuzzle | Tests .h |
Yes | A classic searching problem solved with A* search. A GUI demo is provided. | Wikipedia |
Sort | Tests .h |
Yes | Including insertion sort, selection sort, heapsort, quicksort, quickselect. For merge sort, please refer to DoublyLinkedList.sort(). | Wikipedia |
Dijkstra | Tests .h |
No | An algorithm to find the shortest paths between vertices in a graph. | Wikipedia |
LCS | Tests .h |
No | A dynamic programming solution to find the longest subsequence or substring common to two sequences. | Wikipedia (substring) Wikipedia (subsequence) |
Name | Source | Benchmarked | Note | Reference |
---|---|---|---|---|
TextQuery | Tests .h .cpp |
No | Search a given input stream for words. (OOP practice) | §12.3 & §15.9, C++ Primer, 5th Edition |
SharedPtr | Tests .h |
No | My own version of std::shared_ptr. | §12.1 & §16.1.6, C++ Primer, 5th Edition |
UniquePtr | Tests .h |
No | My own version of std::unique_ptr. | §12.1 & §16.1.6, C++ Primer, 5th Edition |
-
Build with CMake:
-
Build benchmarks only
$ mkdir build $ cd build $ cmake [-G <generator>] ..
-
Build benchmarks and testss
$ mkdir build $ cd build $ git submodule init $ git submodule update $ cmake [-G <generator>] -DTASTYLIB_BUILD_TEST=ON ..
You can customize the CMake Generators.
-
-
Build with GNU Make (assuming a Makefile generator was used):
$ make
-
All executables will be generated in the
bin
directory. Run all tests:$ ctest
See the LICENSE file for license rights and limitations.