Text: Java, Maximum Contiguous Subsequence Sum Problem
In the first task, you are expected to implement the three solutions for the maximum contiguous subsequence sum problem in the textbook (discussed in class). The three solutions should be implemented in three separate Java files (Solution1.java, Solution2.java, and Solution3.java). In each Java file:
1. Implement a method public static int[] theMCSS(int[] A) which accepts the input and returns an array that contains the start and end positions of the maximum contiguous subsequence. Some sample inputs and return values of the function are shown below:
Input: {1, 3, -5, 7, 4, -2}
Return Value: {-2, 11}
Input: {-4, 13, -5, 2}
Return Value: {20}
Input: {-2, -5, -20, -5, -7}
Return Value: {1, 3}
Input: {3, 4}
Return Value: {1, 3}
Input: {-1, -1}
Return Value: {-1, -1}
2. Write a method public static void testSolutionO() to test your theMCSS method using some sample inputs and to assert that the correct output is given.
Task 2: Analyzing the Performance
Test and record the time taken by the three solutions for different input sizes (at least for 10, 100, 1000, 10000).
For each input size, generate at least two test cases (two different inputs). For each test case, run the program at least three times and collect the time value, then take the average of all the runs. Record the results in the following table (or a similar table):
Input & Test Size 10 - Input 1 - Test 1 Size 10 - Input 1 - Test 2 Size 10 - Input 1 - Test 3 Size 10 - Input 1 Average Size 10 - Input 2 - Test 1 Size 10 - Input 2 - Test 2 Size 10 - Input 2 - Test 3 Size 10 - Input 2 - Average Size 10 - Average Size 100 - Input 1 - Test 1 Size 100 - Input 1 - Test 2 Size 100 - Input 1 - Test 3 Size 100 - Input 1 Average Size 100 - Input 2 - Test 1 Size 100 - Input 2 - Test 2 Size 100 - Input 2 - Test 3 Size 100 - Input 2 - Average Size 100 - Average
Solution 1 Solution 2 Solution 3
Plot the results (average execution time against the input size) for the three solutions on the same graph. Comment on any observations and interesting patterns. Submit your report as a PDF document.