I am looking into an Euler project. Specifically #18.
To sum up, the idea is to find the max path from a triangle:
3
7 4
2 4 6
8 5 9 3
3 + 7 + 4 + 9 = 23.
Reading for this, most people indicate that this is solved correctly by working bottom to top instead of using an algorithm that works "greedy" from top to bottom.
I can understand that starting from top and going down selecting the max you find is "shortsighted" and may not be the overall max.
But why is the approach of going from bottom to top any better?
It seems to me it suffers from the same problem.
For example in the triangle in the example we would get (starting from bottom):
9+6+4+3=22 < 23
So why start from bottom-up?
See Question&Answers more detail:os