Sorry.. u need 2 sort only one array. whichever u likei was thinking to
sort 1 array and wrote to sort all 3 anyway ... sort only one
On Tue, Jan 11, 2011 at 1:18 PM, MOHIT wrote:
> @ puneet then we have to sort only one array, on which we doing binary
> search why all 3?
>
> -
@ puneet then we have to sort only one array, on which we doing binary
search why all 3?
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send ema
@above
This cannot be done in a linear time. Cause you have two Separate arrays.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
a
This cannot be done in a linear time. Cause you have two Separate arrays.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeek
sort two of the list and pick one number in C(unsorted) to find if there
exists a pair with the sum.
This can be done in linear time by maintaining two pointers.
Hence O(n^2).
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this gr
How big is the data set? In case the three arrays are quite large, probably
they can be divided into smaller sets and then possible combinations can be
given to separate threads like {A1,B1,C1}, {A1,B1,C2}...{A1,B2, C1}...where
we make BST (one of AVL or RB Tree ) for set C1, C2 etc... and each set
can't u presort one of them in O(nlogn)...???
On Tue, Jan 11, 2011 at 5:05 AM, dinesh bansal wrote:
> I think for unsorted lists, it will be O(n^3).
>
>
>
> On Tue, Jan 11, 2011 at 1:26 PM, juver++ wrote:
>
>> There is no need to sort first two arrays.
>>
>> --
>> You received this message beca
I think for unsorted lists, it will be O(n^3).
On Tue, Jan 11, 2011 at 1:26 PM, juver++ wrote:
> There is no need to sort first two arrays.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge
does any better solution exists than O(N^2logN)??
On Tue, Jan 11, 2011 at 2:56 AM, juver++ wrote:
> There is no need to sort first two arrays.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algo
There is no need to sort first two arrays.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
sort all 3 arrays. then for any every combination of numbers in 2 arrays
say, a and b do a binary search for element -(a+b) in the third array. It
would be a O(N^2 logN) algorithm
On Tue, Jan 11, 2011 at 12:04 PM, Decipher wrote:
> Given three lists: A, B and C of length n each. Write a function
Given three lists: A, B and C of length n each. Write a function which
returns true if any 3 three numbers (1 from each list), sum up to zero. Else
return false, if there is no such combination.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" grou
12 matches
Mail list logo