Depth counts edges from the root down to a node, so the root has depth zero. Height counts edges on the longest path from a node down to a leaf, so a leaf has height zero.
So depth looks upward toward the root, and height looks downward toward the deepest descendant. The whole tree's height equals the root's height, which is the longest root-to-leaf path. That number drives cost, because search and insert run in time proportional to height.
A short height means fast operations. When people say a tree is O(log n), they mean its height stays near log n instead of growing linearly.
A common mix-up is swapping the two or counting nodes instead of edges. Some texts count nodes, making both values larger by one, so always confirm the convention.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
The diagram below the answer is the concept . Jump to it ↓