Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need this code written in java language please and thank you. (a) Modify Algorithm 2, 3 & 4 so that they return in the value

image text in transcribed

Need this code written in java language please and thank you.

(a) Modify Algorithm 2, 3 & 4 so that they return in the value of the maximum subsequence and the starting and ending indices of the maximum subsequence. 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. Your program should measure (print) the execution time of these algorithms (Algorithm 2, 3 & 4) in nanoseconds. > java maxsumTest Please enter the size of the problem (N): 25 673 -869 -153 214 -139 40 65 -925 500 -639 -696 956 823 -714 967 Algorithm 2: MaxSum: 2532, Sindex: 10, E index: 14 Execution Time: 13 milliseconds Algorithm 3: MaxSum: 2532, Sindex: 10, E index: 14 Execution Time: 18 milliseconds Algorithm 4: MaxSum: 2532, S_index: 10, E_index: 14 Execution Time: 9 milliseconds

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

c. What were the reasons for their move? Did they come voluntarily?

Answered: 1 week ago

Question

How do books become world of wonder?

Answered: 1 week ago

Question

If ( A^2 - A + I = 0 ), then inverse of matrix ( A ) is?

Answered: 1 week ago

Question

=+8. Why is productivity important?

Answered: 1 week ago

Question

=+ 9. What is inflation and what causes it?

Answered: 1 week ago