Tools / Data structures Interview questions
How to find the height of a node in a tree?
Node height is the number of edges on the longest path down to a leaf. A leaf has height 0; compute it recursively from the children.
The height of the node is equal to the number of edges in the longest path to the leaf from the node. The depth of a leaf node is 0.
Height of the tree is nothing but the height of the root node.
More Related questions...