Binary search tree (BST) is a special type of tree which follows the following rules −
left child node’s value is always less than the parent Note
right child node has a greater value than the parent node.
all the nodes individually form a binary search tree.
Search operation in BST
Performing a search in a binary search tree,
We need to search for a key in the tree. For this, We will compare the key with the root node of the tree.
Insertion operation in BST
Insertion operation in a BST takes place at the leaf node of the tree for insertion we will start the comparison of the node with the root node and find the correct position of the node and then place it. The following example will make it more clear to you.