Why it matters
DSU on Tree enables efficient subtree aggregations.
Advertisement
The architecture
Process heavy child first.
Keep its data; add light children data.
Advertisement
How it works end to end
Applications: subtree color counts, distinct value counts.
Implementation: DFS with heavy inheritance.