Using the C programming language, how can I generate an algorithm to solve this problem?

Take a sequence of 2n real numbers as input.
Design an algorithm O (n log n) that partitions numbers into n pairs, with the property that the partition minimizes the maximum sum of a pair.
For example, suppose we are given the numbers (1,6,3,7), the possible partitions are ((1,6), (3,7)), ((1,3), (6) , 7)) and ((1,7), (3,6)).
The sum of the pairs for these partitions is (4,13), (7,10) and (8,9).
So, the third partition has 9 as the maximum sum, which is the
minimum on all three partitions.