Pick the fix
Why can a simple 'height(left) + height(right) at the root' be wrong?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A The longest path can bend at a node deep in one subtree
Right: a lopsided tree can hide its longest path entirely on one side.
Checking every node as a possible bend point is what finds the path, and the bottom-up walk does it in one pass.
Why not the others?
- B Heights must be counted in nodes. Edges versus nodes changes the number, not where the path is.
- C The root always lies on the longest path. That is exactly the false assumption.