Nubert is a high-level manager in a software firm and is managing n software projects. He is asked to assign m of the programmers in the firm among these n projects. Assume that all of the programmers are equally (in)competent. After some careful thought, Nubert has figured out how much benefit i programmers will bring to project j. View this benefit as a number. Formally put, for each project j, he has computed an array Aj [0..m] where Aj [i] is the benefit obtained by assigning i programmers to project j. Assume that Aj [i] is nondecreasing with increasing i. Further make the economically-seeminglysound assumption that the marginal benefit obtained by assigning an ith programmer to a project is nonincreasing as i increases. Thus, for all j and i ≥ 1, Aj [i + 1] − Aj [i] ≤ Aj [i] − Aj [i − 1]. Help Nubert design a greedy algorithm to determine how many programmers to assign to each project such that the total benefit obtained over all projects is maximized. Justify the correctness of the algorithm and analyze its running time.
Nubert is a high-level manager in a software firm and is managing n software projects. He is
asked to assign m of the programmers in the firm among these n projects. Assume that all of the
programmers are equally (in)competent.
After some careful thought, Nubert has figured out how much benefit i programmers will bring
to project j. View this benefit as a number. Formally put, for each project j, he has computed
an array Aj [0..m] where Aj [i] is the benefit obtained by assigning i programmers to project j.
Assume that Aj [i] is nondecreasing with increasing i. Further make the economically-seeminglysound assumption that the marginal benefit obtained by assigning an ith programmer to a project
is nonincreasing as i increases. Thus, for all j and i ≥ 1, Aj [i + 1] − Aj [i] ≤ Aj [i] − Aj [i − 1].
Help Nubert design a greedy
project such that the total benefit obtained over all projects is maximized. Justify the correctness
of the algorithm and analyze its running time.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps