Header-only C++17
No build step is required for the library itself. Add the include path and compile with a C++17 compiler.
Modern header-only C++17 Binary Search Tree library with smart-pointer memory management, comparator support, STL-style iterators, and public documentation designed for learning and lightweight production use.
Quick Preview
The docs are tuned for code reading: narrow content width, sticky navigation, and code blocks that never place controls on top of the source text.
#include <iostream>
#include <bst/bst.h>
int main() {
BinarySearchTree<int> tree = {8, 3, 10, 1, 6};
tree.insert(14);
for (int value : tree) {
std::cout << value << ' ';
}
}
Distribution
Single header
Docs style
Static + responsive
No build step is required for the library itself. Add the include path and compile with a C++17 compiler.
Insertion returns {iterator, bool}, iteration is bidirectional, and lookup feels familiar.
Customize sort order with BinarySearchTree<T, Compare> instead of relying only on operator<.
Use in-order, pre-order, and post-order traversal functions for inspection, printing, or exporting.
The repository includes a CMake-based test flow and GitHub Actions checks for public reliability.
Every major page is structured for reading code, browsing API categories, and navigating quickly on mobile or desktop.
This is a plain Binary Search Tree, not a self-balancing AVL or Red-Black tree.
Sorted insertion can degrade operations to O(N). That tradeoff keeps the library easy to study and lightweight to embed.