Interview Bootcamp
Ask Author
Back to course home

0% completed

Vote For New Content
Shaikh Saleem
Height vs. Depth

Shaikh Saleem

Nov 10, 2024

"The height of a tree is the number of edges on the longest path from the root node to the leaf node. It represents the depth of the tree from the root. In contrast, the depth of a specific node in the tree is the number of edges from the root node to that particular node."

This is confusing, what does it mean? Does it mean height is same as depth?

0

0

Comments
Comments
P
pinky3092 a year ago

It means that the height of the tree = depth of the tree. However, if we are talking about a node in the tree, then the height of the node is the longest number of edges from that node to leaf node and depth of the node is the longest number of edges fro...