# Project 1 You are given an input array 𝐴[1, … , 𝑁]. A grouping

\$30.00

Category:
Rate this product

Project 1 (15 pt.)
Problem Description:
You are given an input array 𝐴[1, … , 𝑁]. A grouping of the array 𝐴 is described by an array 𝐺[1, … , 𝑀],
where the array 𝐴 is partitioned into 𝑀 groups, the 1st group consists of the first 𝐺[1] elements of array 𝐴,
the 2nd group consists of the next 𝐺[2] elements, and so forth. Define array 𝐵[1, … , 𝑀] such that 𝐵[𝑗] is
the summation of the elements in the 𝑗-th group of array 𝐴. Use a dynamic programming algorithm to find
a grouping of array 𝐴 with 𝑀 groups such that we maximize the minimum element of array 𝐵.
Max-min-grouping(𝐴, 𝑁, 𝑀)
{
return 𝐺[1, … , 𝑀]
}
Hint:
• The optimal subproblem property: suppose the optimal solution to Max-min-grouping(𝐴, 𝑁, 𝑀)
is 𝐺[1, … , 𝑀] = [𝑛1,𝑛2, … , 𝑛𝑀−1,𝑛𝑀] . Then 𝐺[1, … , 𝑀 − 1] is the optimal solution to the
subproblem Max-min-grouping(𝐴, 𝑁 − 𝑛𝑀, 𝑀 − 1).

## Reviews

There are no reviews yet.

Scroll to Top