Discussion
What is the height of a binary tree with 7 nodes ?
Answer: A
The key gives 3.
Seven nodes fill a complete binary tree exactly: 1 node at the root, 2 on the next level and 4 on the last. That is 3 levels, and counting levels, the height is 3, which is how the key reads the question.
\[ 1 + 2 + 4 = 7 \]Counting edges instead, the same tree has height 2, which is option C, and a skewed 7-node tree would be taller still. The paper states neither a convention nor the shape of the tree, so the item is loose. The key gives A, so it is kept; note that textbooks that define height as the number of edges on the longest path give 2 for the complete tree. Option D, 7, is only the height of a degenerate chain counted in nodes, and 4 fits no 7-node complete tree.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development