What is the node path length of a node with 0 or 1 child?

Category: QuestionsWhat is the node path length of a node with 0 or 1 child?
Editor">Editor Staff asked 4 weeks ago

What is the node path length of a node with 0 or 1 child?
 
(a) 1
 
(b) -1
 
(c) 0
 
(d) null
 
The query is from Heap in chapter Heap of Data Structures & Algorithms I
 
This question was addressed to me in an interview for internship.

1 Answers
Editor">Editor Staff answered 4 weeks ago

The correct answer is (c) 0
 
The explanation is: The length of the shortest path from a node to a node without two children is defined as 0.