MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Assume the level of root node is 1 and the levels of left and right children of root is 2. The maximum number ofnodes on level i of a binary tree is
A
2^i
B
2^(i-1)
C
2^(i+1)
D
2^i+1
Explanation: 

Detailed explanation-1: -For example, level of root is 1 and levels of left and right children of root is 2. The maximum number of nodes on level i of a binary tree is : if level is 3 then there will be maximum 7 nodes in the binary tree. which is 2^3-1=8-1=7.

Detailed explanation-2: -1) The maximum number of nodes at level ‘l’ of a binary tree is 2l-1. Here level is number of nodes on path from root to the node (including root and node). Level of root is 1. This can be proved by induction.

Detailed explanation-3: -In Pre-Order traversal, we traverse in the following order: First visit the node itself. Then visit the left subtree of the node. Then visit the right subtree of the node.

Detailed explanation-4: -The maximum number of nodes at level ‘l’ will be 2l−1 . Here level is the number of nodes on path from root to the node, including the root itself. We are considering the level of root is 1.

Detailed explanation-5: -The topmost node of a binary tree is the root node. The level of a node is the number of edges along the unique path between it and the root node. Therefore, the root node has a level of 0. If it has children, both of them have a level of 1.

There is 1 question to complete.