binary tree
9
3
15
20
7
call stack ↓
(returned)
Recursive DFS (post-order)
▸1depth(node):2 push frame3 if node is null: return 0 // base case4 L = depth(node.left)5 R = depth(node.right)6 return 1 + max(L, R) // combine
state
- goallongest root→leaf