Data Structures
Trees
GATE 2007
Easy
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height h is:
- A2^h - 1
- B2^(h-1) - 1
- 2^(h+1) - 1
- D2^(h+1)
Explanation
A binary tree of height h (edges on longest path) has h+1 levels, each level i (0-indexed) holding up to 2^i nodes. Total maximum nodes = 2^0+2^1+...+2^h = 2^(h+1) - 1.
Source: GATE CS 2007 (2007)
This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.