[Solved] CSE100 Algorithm Design and Analysis Lab 04,

$25

File Name: CSE100_Algorithm_Design_and_Analysis_Lab_04,.zip
File Size: 414.48 KB

SKU: [Solved] CSE100 Algorithm Design and Analysis Lab 04, Category: Tag:
5/5 - (1 vote)

Max Subarray

In this lab assignment, your job is to implement the O(nlogn) 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[1n] of n integers, and would like to find 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].

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSE100 Algorithm Design and Analysis Lab 04,
$25