Arrays are linear. You process left to right. Trees branch. A node's answer depends on all its children, and sometimes on its parent too.
So, what should we do?
The standard trick is post-order traversal: solve children first, then combine at the parent. But some problems need information flowing both ways. What's the farthest node from each vertex? What if the root changes? I'll show you rerooting, subtree aggregation, and path queries. Trees have structure, and you should use it.