GATE / CS ARCHIVE

GATE CSE 2015 SET 1 / QUESTION 15

GATE CSE 2015 Set 1 Q15

Data Structures · Tree Properties & Traversals · Full GATE CSE 2015 Set 1 paper

GATE 2015 Set 1, Q15 1 mark · MCQ
Report issue

Tree Properties & Traversals

Question 15, GATE 2015: Height means the length in edges of the longest root-to-leaf path. Find maximum and minimum node counts of a binary tree of height 5. A 63 and 6; B 64 and 5; C 32 and 6; D 31 and 5.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Levels run from depth 0 through 5. At most 2d nodes fit at depth d, so the maximum is the geometric sum 26−1=63. The minimum still requires one path containing five edges, hence six vertices. The number 32 counts only the possible last-level nodes, not the entire tree.

Solution: Height5 counts edges. The complete tree has 1+2+4+8+16+32=63 nodes; a single path needs 6. Thus maximum 63 and minimum 6, A.

Original paper, page 7 · Answer key