Binary Search Tree

  • 1.1) Introduction to Binary Search Tree
    For every node ‘N’, all elements in the left subtree of ‘N’ are less than the value of ‘N’, and all elements in the right subtree of ‘N’ are greater than the value of ‘N’.
  • 1.2) Binary Search Tree Implementation
    BST C++ code that creates a simple Binary Search Tree and inserts elements into it while maintaining the BST property: elements in the left subtree are smaller, and elements in the right subtree are larger.
  • 1.3) Binary Search Tree Deletion
    When deleting a node in a Binary Search Tree (BST), there are three possible cases to consider: a)Node has no children (leaf node) b) Node has one child c) Node has two children
  • 1.4) Find the Floor of given value in BST
    The “floor” of a given value is the largest value in the tree that is less than or equal to the given value. In other words, it’s the “closest” value in the tree that is not greater than the given value.
  • 1.5) Self-Balancing Binary Search Trees (BSTs)
    BSTs offer fast search, insert, and delete operations when they are “balanced” – meaning the tree’s height is relatively small and comparable to the logarithm of the number of nodes.