Suggest an editImprove this articleRefine the answer for “How are the height and depth of a tree related?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**Height** and **depth** of a tree are related but oppositely directed characteristics: depth is measured downward from the root, height upward from a leaf. **Key point:** the maximum depth of a tree equals its height.Shown above the full answer for quick recall.Answer (EN)Image**Height** and **depth** of a tree are related but oppositely directed characteristics. ## Depth Measured **downward from the root**. Shows how far a specific node is from the root. ```javascript depth(node) = number of edges from the root to this node ``` ## Height Measured **upward from a leaf**. Shows how many edges lie between a node and the deepest leaf. ```javascript height(node) = length of the longest path from this node to a leaf ``` ## Relationship - **The root's depth = 0**, **the tree's height = the root's height**. - **The depth of the deepest node = the tree's height.** ## Example ```javascript A / \ B C / \ D E ``` - Depth of `A` = 0, `B` = 1, `D` = 2 - Tree height = 2 The maximum depth of a tree equals its height. ## Summary **Depth** is the path *down to a node*, **height** is the path *up from a node*. Maximum depth = the height of the whole tree.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.