I am doing a refresher an algorithms and data structures.
I am confused on the concept of depth vs height of a tree. In many cases, especially on sites focusing on interview quizes, it seems to me that these terms are used interchangeably.
It seems to me that the basic literature defines them as applicable to a node and not to a tree.
So the depth of the root (which is a node) is 0
. The height of root (or any subnode) is the max height of its children.
But when you apply these terms on a tree i.e. find the max depth of a tree, it seems that these terms now are "meaningless" and can be used interchangeably i.e. to find the max depth just calculate max height.
For example in this post Check if tree is balanced the answers focus on the height of the tree while the definition of balance could be on the depth of the tree
Is my understanding correct or am I messing up on these fundamentals?