39.4k views
0 votes
Let A and B be two sets of n positive integers. You get to reorder each set however you like. After reording, let ai be the i-th element of A and bi be the i-th element of B. The goal is to maximize the function n Π (i=1) ai^bi . You will develop a greedy algorithm for this task.

Required:
a. Describe a greedy idea on how to solve this problem, and shortly argue why you think it is correct (not a formal proof).
b. Describe your greedy algorithm in pseudocode. What is its runtime?

User Valbaca
by
4.8k points

1 Answer

7 votes

Answer:

Describe your greedy algorithm in pseudocode. What is its runtime?

User Azmuhak
by
5.0k points