MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Tree has 6 edges state the number of nodes is present
A
6
B
5
C
7
D
0
Explanation: 

Detailed explanation-1: -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. Height of a tree with single node is considered as 1.

Detailed explanation-2: -The total number of nodes is (N^L-1) / (N-1).

Detailed explanation-3: -You get the maximum height h=6 with 7 nodes, at degenerate cases, that is when the numbers inserted are in ascending or descending order. So, only the insertion orders (1, 2, 3, 4, 5, 6, 7) and (7, 6, 5, 4, 3, 2, 1) will give height 6. So the answer is 2.

Detailed explanation-4: -Minimum number of nodes in a binary tree whose height is h. At least one node at each of first h levels. All possible nodes at first h levels are present. A full binary tree of a given height h has 2h – 1 nodes.

There is 1 question to complete.