Modern BST Documentation

BinarySearchTree.h

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.

C++17 Header-only STL-style iterators Comparator support Smart pointers CI tested

Quick Preview

Readable by design

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.

C++
#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

Header-only C++17

No build step is required for the library itself. Add the include path and compile with a C++17 compiler.

STL-style API

Insertion returns {iterator, bool}, iteration is bidirectional, and lookup feels familiar.

Comparator Support

Customize sort order with BinarySearchTree<T, Compare> instead of relying only on operator<.

Traversal Helpers

Use in-order, pre-order, and post-order traversal functions for inspection, printing, or exporting.

Tested with CI

The repository includes a CMake-based test flow and GitHub Actions checks for public reliability.

Public Documentation

Every major page is structured for reading code, browsing API categories, and navigating quickly on mobile or desktop.

Important note

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.