# AVL Tree Height

What is the height of an AVL Tree? I keep finding contradicting definitions.

I found these two on wiki:

Height of node: The height of a node is the number of edges on the longest path between that node and a leaf.

Height of tree: The height of a tree is the height of its root node.

But then I find examples like this: http://pages.cs.wisc.edu/~ealexand/cs367/NOTES/AVL-Trees/avl1.png

In my course, in the lecture notes it uses the height in the way the above picture does. But then in the course textbook it uses the height in the same way the google definition does. So, honestly, I'm not sure which way is correct. What would an AVL tree, of height 5 for example, look like?

• Your question would be clearer if you could explain the definition that the picture illustrates, and what the supposed conflict is. Aug 1, 2016 at 11:19
• @TomvanderZanden By the wikipedia definition, the example I gave the root would have height 3, and not 4 as is shown. And by the second definition, the height of the tree would be 3, and not 4 as is shown. Aug 1, 2016 at 11:28
• What is the second definition? The picture just shows a tree whose vertices are labeled with heights, but how can one tell from just that picture what the definition is? Aug 1, 2016 at 11:32
• @TomvanderZanden If you look at the example, and apply the definition of the height of the tree, the tree has height 4. But if you look at the example, and apply both the definition of the height of node and the height of tree, the tree has height 3. This is where my confusion comes from. Aug 1, 2016 at 11:35

You can use either definition of height, so long as you are consistent in which one you use. The difference between the definitions is presumably just an additive factor $1$ (since one definition counts edges and the other appears to count nodes), which is irrelevant for most CS purposes. There is no "correct" definitions as different authors have come up with and used their own definitions.