MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The height of a tree is the length of the longest root-to-leaf path in it. The maximum and minimum number ofnodes in a binary tree of height 4 are
A
31 and 5
B
32 and 5
C
15 and 5
D
15 and 4
Explanation: 

Detailed explanation-1: -We know that the maximum no. of nodes in a binary tree with (height) h = 2h + 1 – 1. And the minimum no. of nodes with height h is h + 1.

Detailed explanation-2: -The diameter of a binary tree is the length of the longest path between any two nodes in a tree.

Detailed explanation-3: -The height of a binary tree is the maximum number of edges in any root to leaf path.

Detailed explanation-4: -The maximum number of nodes in a complete binary tree is 2h+1-1. The minimum number of nodes in a complete binary tree is 2h. The minimum height of a complete binary tree is log2(n+1) – 1.

There is 1 question to complete.