traversal-accumulation-universal-across-data-structures

Status: IN

The single-traversal accumulation paradigm — visit each element once while maintaining state via accumulators — is a recurring algorithmic shape across data structures: arrays use left-to-right streaming with scalar variables, and trees use DFS with closure-captured variables. Both achieve efficient single-pass O(n) computation, suggesting that traversal-order discipline is a primary mechanism for correctness in these patterns.

Justifications

Generalizes the dominant streaming shape beyond linear sequences to recursive structures, with closure variables as the tree analogue of scalar accumulators

Depends on (SL): tree-postorder-closure-idiom, single-pass-streaming-dominant-shape

Depended on by

JSON