n largest pairs from two sorted array

Given two sorted positive integer arrays A(n) and B(n), we define a set S = {(a,b) | a in A and b in B}.
Obviously there are n^2 elements in S. The value of such a pair is defined as Val(a,b) = a +b.
Now we want to get the n pairs from S with largest values.

Comments

Popular posts from this blog