This is a simple question from algorithms theory. The difference between them is that in one case you count number of nodes and in other number of edges on the shortest path between root and concrete node. Which is which?
Gabriel Ščerbák
2010-04-09 09:51:33
@Peter Alexander: Does it make any sense for depth and height to have different conventions? What if they both were `edges` or `vertices`?
Lazer
2010-04-20 17:13:41
+8
A:
I learned it as a Node having a depth and height. The depth of a node is the number of edges from the node to the tree's root, and the height of a node is the number of nodes on the longest path from the node to a leaf. When you take the root of the tree as the subject node, the depth would be 0 and the height would be the number of nodes on the longest path to a leaf.
Virtlink
2010-04-08 21:52:13
+1 was about to add quote with same content from here: http://en.wikipedia.org/wiki/Tree_%28data_structure%29
Péter Török
2010-04-08 21:53:38
hmm I thought the terminology is not ambiguous, however thanks for the link.
Gabriel Ščerbák
2010-04-08 21:59:10