Skip to content

AlexandarDjordjevic/Trees

Repository files navigation

BST

Build CodeFactor Licence

Binary Search Tree data structure implementation.

  • C++11 C++ version
  • CMake build system
  • g++ C++ compiler
  • STL only libraries

Requirements

  • CMake 3.8
  • gcc
  • c++11

Build

    mkdir build
    cmake . -B build
    cmake --build build --target all

API List

  • BST(); - Default constructor
  • void insert(KEY_T key); - insert new element into the tree
  • void remove(KEY_T key); - remove element from the tree
  • KEY_T min() const; - Return tree min key value
  • KEY_T max() const; - Return tree max key value
  • bool is_empty() const; - Check if tree is empty
  • size_t size() const; - Return number of tree elements
  • bool contains(KEY_T key) const; - Check if the BST contains given key

Examples

Example 1: Demonstrate library usage with double type
Example 2: Demonstrate library usage with integer type