Skip to content

Algorithm for finding the maximum sum of the proper path with the rules in orthogonal triangle. Max cost path problem (Java / Eclipse Ide)

Notifications You must be signed in to change notification settings

Yusufss4/calculateTheMaxSumFromPyramid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

Explanation

Algorithm for finding the maximum sum of the proper path with the rules in orthogonal triangle.

Problem

You will have an orthogonal triangle input from a file and you need to find the maximum sum of the numbers according to given rules below;

  1. You will start from the top and move downwards to an adjacent number as in below.
  2. You are only allowed to walk downwards and diagonally.
  3. You can only walk over NON PRIME NUMBERS.
  4. You have to reach at the end of the pyramid as much as possible.
  5. You have to treat your input as pyramid.

According to above rules the maximum sum of the numbers from top to bottom in below example is 24.

   *1
  *8 4
 2 *6 9
8 5 *9 3

Solution Flowchart

Algorithm

What can be improved?

  1. Currently if there is no path available it doesnt give an error. It should be implemented.
  2. Finding the prime algorithm can be improved by using another complex algorithms.
  3. Try and catch code blocks should be added in file read, input read and convertStringToTheIntMatrix functions.

About

Algorithm for finding the maximum sum of the proper path with the rules in orthogonal triangle. Max cost path problem (Java / Eclipse Ide)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages