Question: You are given two sequences A and B, each containing n positive integers. You can reorder each set in whatever way you want. After reordering,

You are given two sequences A and B, each containing n positive integers. You can reorder each set in whatever way you want. After reordering, let aibe the i-th element of sequence A and let bi be the i-th element of sequence B. You then receive a payoff of -1 ad dollars. Give a greedy algorithm to maximize your payoff. Prove that your algorithm is correct and analyze its running time
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
