MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
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 height is the maximum distance of a leaf node from the root)?
A
2
B
3
C
4
D
5
Explanation: 

Detailed explanation-1: -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 height is the maximum distance of a leaf node form the root)? No worries!

Detailed explanation-2: -This can be proved by induction. 2) Maximum number of nodes in a binary tree of height ‘h’ is 2h – 1. Here height of a tree is maximum number of nodes on root to leaf path.

Detailed explanation-3: -Explanation: A balanced full binary tree with l leaves has height h, where h = log2l + 1.

Detailed explanation-4: -Minimum number of nodes: We have seen that we require a minimum of 1 node so that we can construct a binary tree with level n. We can calculate the minimum number of nodes with level n in a binary tree with the help of formula: n-1. The behavior of linked list data structure and the binary tree is the same.

There is 1 question to complete.