tree-postorder-closure-idiom

Status: IN

Tree solutions combine closure-based DFS (capturing mutable result variables from the enclosing scope for side-effect accumulation) with postorder return values (propagating subtree summaries upward for recursive composition), enabling single-pass O(n) tree computations that both accumulate a global answer and compose local results.

Justifications

Closures handle cross-subtree accumulation while postorder handles intra-subtree composition — together they cover all tree computation needs

Depends on (SL): closure-dfs-pattern, postorder-accumulator-pattern

Depended on by

JSON