Question: Consider a sequence of 2n values as input. Give an efficient algorithm that partitions the numbers into n pairs, with the property that the

Consider a sequence of 2n values as input. Give an efficient algorithm 

Consider a sequence of 2n values as input. Give an efficient algorithm that partitions the numbers into n pairs, with the property that the partition minimizes the maximum sum of a pair. For example, say we are given the numbers (2,3,5,9). The possible partitions are ((2,3),(5,9)), ((2,5), (3,9)), and ((2,9),(3,5)). The pair sums for these partitions are (5,14), (7,12), and (11,8). Thus the third partition has 11 as its maximum sum, which is the minimum over the three partitions. Give and justify its complexity.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem efficiently you can sort the input sequence in ascending order Then pair the s... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!