@Varun output for your test cases are as below: arr1[0] + arr2[0] = 38 arr1[0] + arr2[1] = 33 arr1[1] + arr2[0] = 28
arr1[0] + arr2[0] = 38 arr1[0] + arr2[1] = 37 arr1[0] + arr2[2] = 36 what i was talking about worst case was that is if one have to find more than N elements of array c then it is possible that one of the pointer go out of boundry of 1 to N in worst case. On Mon, May 3, 2010 at 6:48 PM, Varun Nagpal <varun.nagp...@gmail.com>wrote: > @Jitendra > I dont think so.Try these 2 examples to check: > > A[1..n] :20 10 0 > B[1..n] :18 13 5 > Ans :38 33 28 > > A[1..n] :20 10 0 > B[1..n] :18 17 16 > Ans :38 37 36 > > My conjecture is: In the worst case, instead of combination of 1st > element of first array with all elements of second array, we need to > instead choose 2 elements from first array and than take combination > with all elements of second array. Also before doing this we need to > choose from which array should these 2 elements be extracted. I have > already suggested before how to do this. > -- 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. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.