Question: Implement the actual program in C++ Just 1 algorithm (number2) with the following specifications: Write a program that solves Exercise 2.19. You need to modify
Implement the actual program in C++ Just 1 algorithm (number2) with the following specifications:
Write a program that solves Exercise 2.19. You need to modify the programs for each of the 4 algorithms for the maximum-subsequence-sum problem so that the program not only returns the maximum sums of subsequences of the given integer array but also returns/outputs the actual subsequence where the sum of integers is maximum. Run each algorithm on three randomly generated integer arrays of sizes N=1,000, 10,000, and 100,000, measure the running times, and determine if they are consistent with the theoretical analysis results of those algorithms given in class, i.e., if the running time of algorithm 1 for the MSS problem is proportional to N3 and that for Algorithm 2 is proportional to N2, etc. Include a table in your report that summarizes the actual running times (in appropriate time units) and narrative about your observations regarding whether the implemented algorithms indeed demonstrate behaviors entailed by theoretical analysis.
Exercise 2.19: The maximum contiguous subsequence sum algorithms in the text do not give any indication of the actual sequence. Modify them so that they return in a single object the value of the maximum subsequence and the indices of the actual sequence.
algorithm 2:

2 *Quadratic maximum contiguous subsequence sum algorithm. 4 int maxSubSum2 const vectorcint>&a int maxSum-0 for( int i 0; i maxSum) .5 6 maxSumthisSum; 8 9 C0 return maxSum; igure 2.6 Algorithm2 2 *Quadratic maximum contiguous subsequence sum algorithm. 4 int maxSubSum2 const vectorcint>&a int maxSum-0 for( int i 0; i maxSum) .5 6 maxSumthisSum; 8 9 C0 return maxSum; igure 2.6 Algorithm2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
