sort A and B seperately -> O(nlgn)..
add A[i]and B[i]  - O(n)
so, O(nlgn) .
linear time maybe possible.


On 8/25/06, Amal < [EMAIL PROTECTED]> wrote:

There are 2 arrays say array A and array B given whose size is 'n'. Now i have to find the first n maximum values of a[i]+b[j] .  I would like to know O(n) or O(n logn ) solutions if some exist.

Amal.





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to