how to determine maximum route cost in a n high numeric pyramid

前端 未结 6 1379
小鲜肉
小鲜肉 2021-02-09 06:15

I\'ve got a numeric pyramid like this

       7
      4 8
     1 8 9
    2 4 6 7
   4 6 7 4 9
  4 9 7 3 8 8

routes: 32

every number indexed by

6条回答
  •  长发绾君心
    2021-02-09 06:41

    I think that even if you use the Suggested Dijkstra's Algorithm, you still have to test every route. First of all because there is no single starting and end point, but there are 50 starting points for the end point. So the algorithm has to be tested 50 times.

    And because every option has 2 paths, there is no way of skipping one. You can never rule out a path untill you are at the very end.

    So I dont think there is a quicker way to find the longest path (so not the shortest as in Dijkstra's Algorithm) then to test all routes.

提交回复
热议问题