Tree: Depth-First Search - Binary Tree Maximum Path Sum
Consider two approaches to compute maximum path sum in a binary tree: (1) Brute force enumerating all paths (O(n²)) and (2) Recursive postorder DFS with global max tracking (O(n)). When is the brute force approach preferable over the recursive DFS?
