The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16. What is the height of the binary search tree?

The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16. What is the height of the binary search tree? Correct Answer 3

The correct answer is option 1

Concept:

A binary search tree (BST) is a node-based binary tree data structure and it follows the following points

  1. Left sub-tree nodes key value will exist only if lesser than the parent node key value.
  2. Right sub-tree nodes key value will exist only if greater than the parent node key value.
  3. Left sub-tree and Right sub-tree must be a Binary search tree.
     

Explanation:

Step 1: First 10 comes and now that is the Root node.

Important Points

Follow the longest path in the tree and count the edges that are height.

Tips To Learn:

Left sub-tree(key)<Node(key)<Right sub-tree(key)

Node(key): Parent node of  Left sub-tree and Right sub-tree

Related Questions