add A[i] and B[i] - O(n)
this is right but..
A[i] + B[j] ( 0<=i, j<=n) - O(n^2)
2006/9/12, Arun <[EMAIL PROTECTED]>:
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
-~----------~----~----~----~------~----~------~--~---
- [algogeeks] Solution needed !! Amal
- [algogeeks] Re: Solution needed !! Arunachalam
- [algogeeks] Re: Solution needed !! Arghawk
- [algogeeks] Re: Solution needed !! Arun
- [algogeeks] Re: Solution needed !! Flávio Barata
- [algogeeks] Re: Solution needed !! philosup
Reply via email to