Thursday, August 18, 2011

The consecutive subsequence of The problem is to find?

the consecutive subsequence of S with maximum sum. “Consecutive” means that you are not allowedto skip numbers. For example if the input was12,−14, 1, 23,−6, 22,−34, 13the output would be 1, 23,−6, 22. Give a dynamic programing algorithm for this problem.HINT: As a first step you might determine why a naive recursive solution is not possible. That is,figure out why knowing the nth number, and the maximum consecutive sum of the first n-1 numbers,is not sufficient information to compute the maximum consecutive sum of the first n numbers. .1)what is the complexity ysis algorithim 2)running program

No comments:

Post a Comment