Binary Search Tree

Introduction to Binary Search Tree
Implementation of Binary Search Tree (C++)
Insertion of elements into BST
Removal of elements from BST
Click here to suggest a better video
Click here to view videos suggested by visitors

A binary search tree is a type of binary tree data structure where every node in the binary tree confirms to the below properties:

For any given node in a binary search tree

  • The left child’s value is smaller than the current node’s value
  • The right child’s value is more than the current node’s value

(If you are new to binary tree’s I suggest you to go through this article first)

Below is visualization of an example binary search tree data structure (Source)

The binary search tree visualized above has a node containing 8 as the root node. The left child of this root node contains 3 which is less than root node’s value. The right child of the root node contains number 10 which is more than the root node’s value. Similarly all the other nodes in the tree follow this property: (value of left child) < (value of current node) < (value of right child). Hence it is a binary search tree.

Note: If there’s even a singe node in a binary tree where the value of left child is greater than value of it’s parent node, or the value of right child is less than value of it’s parent node, it wouldn’t be a binary search tree.

TODO: Add more info along with references.