Q. Explain what do we understand by Binary Search Tree (BST)? Make a BST for the following given sequence of the numbers.
45, 32, 90, 21, 78, 65, 87, 132, 90, 96, 41, 74, 92
Binary search tree is explained below.
A binary search tree is a binary tree which is either empty or in which each node has a key that satisfies the below written conditions : -
All keys (if there are any) in the left sub tree of the root head the key in the root.
The key in the root heads all keys (if there are any) in its right sub tree.
The left and right sub trees of the root are again the search trees. The tree for the following list of numbers is drawn below
45 32 90 21 78 65 87 132 90 96 41 74 92