Greatest Path Sum in Triangle (due 22 Jul 2015)

This assignment is a variation of a problem from Project Euler. You are required to find the greatest path sum starting at the top of the triangle and moving only to adjacent numbers on the row below.

   3
  7 4
 2 4 6
8 5 9 3
In the above triangle, the maximum path sum is 3 + 7 + 4 + 9 = 23.

You will read your input from the file triangle.txt . The first line indicates n the number of rows in the triangle. This will be followed by n lines of data. Each line of data will have only positive integers greater than 0. The first line of data in the triangle will have 1 number, the second line in the triangle will have 2 numbers and so on. The nth line will have n integers.

You will have a single line of output:

The greatest path sum is 23.

For this assignment, we are strongly recommending that you work with a partner. Both of you will have to read the paper on Pair Programming . The two of you will jointly work on this assignment and submit a single copy of the assignment with both your names on it.

The file that you will be submitting will be called Triangle.java. You will choose a data structure that will be appropriate to solve this problem. You will follow the standard Java coding convention that I have appended below. The file will have a header of the following form:

/*
  File: Triangle.java

  Description:

  Student Name:

  Student UT EID:

  Partner Name:

  Partner UT EID:

  Course Name: CS 312

  Unique Number: 

  Date Created:

  Date Last Modified:

*/

There is a modification that I would like to make to the standard coding conventions. Please align the opening and closing braces vertically so that you can easily make out the blocks of code. For example:

Do this:
if ( x > 5 )
{
  a = b + c;
}

Not this:
if ( x > 5 ) {
  a = b + c;
}

Use the Canvas program to submit your Triangle.java file. We should receive your work by 11 PM on Wednesday, 22 Jul 2015. There will be substantial penalties if you do not adhere to the guidelines.