Question: Problems Description: Note that the maximum contiguous subsequence sum algorithms in the text do not give any indication of the actual sequence. In this assignment,

Problems Description: Note that the maximum contiguous subsequence sum algorithms in the
text do not give any indication of the actual sequence. In this assignment, you will modify these
algorithms to return the maximum contiguous subsequence sum including the starting and
ending indexes of the sum. Also, your program will measure their execution times with various
input sizes.
(a) Modify Algorithms 2,3&4 so that they return in the value of the maximum subsequence
sum and the starting and ending indices of the maximum subsequence. Your algorithm will
return '0' if there is no positive number in the input array.
Your algorithm should take input size (N) from the user and generate a random sequence of
N integers ranging from -9999 to 9999. If N is less than 50, your program must print the
randomly generated numbers, and find the maximum subsequence independently (do not
refer the indexes found by other algorithms. Your program should measure (and print) the
execution time of these algorithms (Algorithms 2,3&4) in milliseconds or nanoseconds.
Sample Execution Scenarios >
Please enter the size of the problem (N): 15
673
500967
Algorithm 2:
MaxSum: 2532, S_index: 10, E_index: 14
Execution Time:-}82048\mathrm{ nanoseconds
Algorithm 3:
MaxSum: 2532, S_index: 10, E_index: 14
Execution Time: -}23165\mathrm{ nanoseconds
Algorithm 4:
MaxSum: 2532, S_index: 10, E_index: 14
Execution Time: 11345 nanoseconds
Note: all three algorithms must be executed for the same input numbers >
Problems Description: Note that the maximum

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!