Request solve the undermentioned problem on “Introduction to Alogrithms”
The maximum subsequence sum problem is defined as follows: If a_1, a_2, . a_n are in Z, find the maximum value Sigma^j_k=i a_i, for all i, j, 1 lessthanorequalto i lessthanorequalto j lessthanorequalto n. We assume that the answer is 0 if all the a_i, are negative or if the sum is empty. The following algorithm finds a solution to the problem. Here, we assume that a_is are stored in the array A. MAXIMUM-SUBSEQUENCE(A, MaxSum) 1 Sum leftarrow 0, MaxSum leftarrow 0 2 for i leftarrow 1 to n 3 do 4 Sum = Sum + A [i] 5 if Sum > MaxSum 6 then MaxSum leftarrow Sum 7 else if Sum
Expert Answer