Height / Depth
Learn Height / Depth (Trees, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Height vs Depth - Commonly Confused Terms Depth of a node - the number of edges from the ROOT down to that node. The root has depth 0. Height of a node - the number of edges on the LONGEST path from that node DOWN to a leaf. A leaf has height 0. Height of the tree - the height of the root, i.e. the longest root-to-leaf path.
More lessons in Trees
- Binary Tree
- Binary Search Tree - BST
- Full / Complete / Perfect Binary Tree
- Balanced Tree
- Tree Traversal - Preorder
- Tree Traversal - Inorder
- Tree Traversal - Postorder
- Tree Traversal - Level Order
- Recursive Traversal
- Iterative Traversal
- Diameter of a Tree
- Lowest Common Ancestor
- Path Sum
- Tree View - Left View
- Tree View - Right View
- Tree View - Top View
- Tree View - Bottom View
- Boundary Traversal
- Vertical Traversal
- Zigzag Traversal
- Serialize / Deserialize a Tree
- BST Operations
- BST Validation
- Kth Smallest / Largest in BST
- Morris Traversal