Author |
Topic: Largest values from cartesian product of arrays. (Read 1488 times) |
|
witee
Newbie
Posts: 48
|
|
Largest values from cartesian product of arrays.
« on: Aug 8th, 2010, 6:51am » |
Quote Modify
|
Given two sorted positive integer arrays A(n) and B(n), we define a set S = {(a,b) | a A and b B}. Obviously there are n2 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. T.C <=(nlogn) //title changed --towr
|
« Last Edit: Aug 8th, 2010, 8:15am by towr » |
IP Logged |
|
|
|
|