 This is commonly needed in the manipulation of the various self-balancing trees, AVL trees in particular.The root has depth zero, leaves have height zero, and a tree with only a single vertex (hence both a root and leaf) has depth and height zero.Conventionally, an empty tree (tree with no vertices, if such are allowed) has depth and height −1.