Post-Order Traversal

Domain: Data Structures

🎯 Motivation

Visit left subtree, then right subtree, then root last. Useful for deleting trees or calculating folder sizes.

πŸ“‹ Concrete Example

For tree A(B(D,E), C): post-order gives D, E, B, C, A. The root is visited last in each subtree.

πŸ”— Analogy

Calculating the total size of a folder: you must add up all subfolder sizes first (children), then add the folder’s own size (root) last.