| Start |
|---|
| Maximum Path Sum Basic Information Maximum Path Sum is an algorithm to find out a path such that sum of element(node) of that path is greater than any other path. For example, let's we have a we a triangle as shown below. In above triangle, find the maximum path which has maximum sum.
Answer is, To find out the solution, as always we get an idea of Brute-Force method. Brute-Force method is good for this 4 rows triangle but think about a triangle with 100 or more than 100 rows. So, We can not use Brute-Force method to solve this problem. Let's move to dynamic programming approach. Algorithm: For each and every node in a triangle or in a binary tree there can be four ways that the max path goes through the node.
Example of Maximum Path Sum Algorithm: Space Auxiliary: |
C# Implementation |
Read Article
https://develop.horje.com/learn/1434/reference