Problem Definition
- Given 2N distinct real numbers x1,x2,⋯,x2n−1,x2n
- Want to partition there numbers into n pairs P1,P2,⋯Pn (of two numbers each) which minimises the maximum sum of two numbers in a pair
Greedy Algorithm
- Sort the numbers in increasing order, say y1<y2⋯y2n−1<y2n
- Then our desired ordering is one which pairs yi with y2n+1−i for each 1≤y≤n
Proof
- We claim that y1 can be paired with y2n
- Suppose y1 is paired with yi and yj is paired with y2n
- Note that y1<yj and yi<y2n
- Hence, y1+yi<yj+y2n
- Swap y1 and yj: so the pairs are now {y1,y2n} and {yi,yj}
- y1+y2n<yj+y2n because y1<yj
- yi+yj<yj+y2n because yi<y2n