CSE Lab 04 Max Subarray Solution

$30.00 $24.00

In this lab assignment, your job is to implement the O(n log n) time divide-and-conquer algorithm for the Max Subarray Problem; for the pseudo-code, see page 72 in the textbook. Recall that in the problem, we are given as input an array A[1 n] of n integers, and would like to nd i and j…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

In this lab assignment, your job is to implement the O(n log n) time divide-and-conquer algorithm for the Max Subarray Problem; for the pseudo-code, see page 72 in the textbook. Recall that in the problem, we are given as input an array A[1 n] of n integers, and would like to nd i and j (1 i j n) such that A[i ] + A[i + 1] + + A[j ] is maximized.

Input structure The input starts with an integer number n, which indicates the array size.

Then, the integers, A[1]; A[2]; ; A[n]; follow, one per line.

Output structure Output the sum of integers in the max subarray, i.e., A[i ] + A[i + 1] +

+ A[j ].

CSE Lab 04 Max Subarray Solution
$30.00 $24.00