[algogeeks] array sum

2011-10-01 Thread rahul sharma
all pairs of integers sum upto x.shiuld we take care of duplicates?? -- 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

Re: [algogeeks] array sum

2011-10-01 Thread shady
what is the question ??? On Sat, Oct 1, 2011 at 9:08 PM, rahul sharma rahul23111...@gmail.comwrote: all pairs of integers sum upto x.shiuld we take care of duplicates?? -- You received this

Re: [algogeeks] array sum

2011-10-01 Thread rahul sharma
all integers pairs in array that sum to given value say (k)...i have two sol for the array that contain unique elements..m asking should i take care of duplicates or notcoz my logic wont work for duplicates like if i have 0 1 2 3 4 5 6 8 8 if i want all pairs having some 8 ...den it should

Re: [algogeeks] array sum

2011-08-27 Thread wujin chen
take a subset from the array, if the average is equal then output the result. backtracing can do this. the time complexity seems not low, any good idea~~? 2011/8/27 sukhmeet singh sukhmeet2...@gmail.com how to divide an integer array into 2 sub-arrays and make their averages equal? array is

Re: [algogeeks] array sum

2011-08-27 Thread Ankit Sinha
Algo: 1. Sort the array 2. modify binary search on the set comparing average of both the set. 3. if aveage (start, mid) average (mid , end) then go to left sub set else right subset. This could lead to solution in o(nlogn) time. Please comment futher!! Cheers, Ankit Sinha On Sat, Aug 27,

Re: [algogeeks] array sum

2011-08-27 Thread Neha Singh
@Ankit: Ur solution has some flaws I think. Ur solution assumes that we r dividing the sorted array into 2 halves, but the question says: divide an integer array into 2 sub-arrays and make their averages equal. Take some test case and apply ur solution to it. We cud do this problem in the

[algogeeks] array sum

2011-08-26 Thread sukhmeet singh
how to divide an integer array into 2 sub-arrays and make their averages equal? array is unsorted and we can also take any numbers and the numbers in the array need not be contiguous in the original array. how many total such array's are possible. Output them -- You received this message because