Graph Theory37 sections · 1633 units
Open in Course

Concept - Depth vs Height

Measuring distance

There are two ways to measure vertical distance in a tree.

1.1. Depth: Distance from the root to a node.

The root has depth 00. Its children have depth 11. Their children have depth 22. And so on.

2.2. Height: Distance from a node to the deepest leaf below it.

Leaves have height 00. A node with only leaf children has height 11. The root usually has the maximum height. Depth goes down. Height goes up. They are inverses in a sense.