Re: [algogeeks] triplets summing to zero

2010-06-24 Thread Raj N
@Anurag: The previous question asked was 2 numbers summing upto a given number S. This is triplets. On Thu, Jun 24, 2010 at 5:08 PM, Anurag Sharma wrote: > Its a repeated question. Kindly search the archives for detailed > discussion. > > Anurag Sharma > > > On Wed, Jun 23, 2010 at 10:55 PM, Amir

Re: [algogeeks] triplets summing to zero

2010-06-24 Thread Vivek Sundararajan
This requires O(Range) memory right? (where Range is range of values present in the given array) Please correct me if I am wrong :) On 24 June 2010 17:08, Anurag Sharma wrote: > Its a repeated question. Kindly search the archives for detailed > discussion. > > Anurag Sharma > > > On Wed, Jun 2

Re: [algogeeks] triplets summing to zero

2010-06-24 Thread Anurag Sharma
Its a repeated question. Kindly search the archives for detailed discussion. Anurag Sharma On Wed, Jun 23, 2010 at 10:55 PM, Amir hossein Shahriari < amir.hossein.shahri...@gmail.com> wrote: > sort the array > for each element a[i] > find two elements that sum to -a[i] (this can be done in O(n

Re: [algogeeks] triplets summing to zero

2010-06-24 Thread Amir hossein Shahriari
sort the array for each element a[i] find two elements that sum to -a[i] (this can be done in O(n) ) the overall time is O(n^2) On 6/23/10, Raj N wrote: > Given a list of n integers?(negative and positive), not sorted and > duplicates allowed, you have to output the triplets which sum upto 0.

[algogeeks] triplets summing to zero

2010-06-23 Thread Raj N
Given a list of n integers?(negative and positive), not sorted and duplicates allowed, you have to output the triplets which sum upto 0. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegrou