On Nov 14, 10:58 pm, bittu <[email protected]> wrote: > ya much works is done by above candidate. > i would like to say..use 2 ptrs one from beginning & another from end > take sum=a[start]+a[end]; > find if sum>num > end-- > else if sum<num > start++; > else //sum==num > found; > > time compexcity O(n) sizeof array > space compexcity O(1)
This only works when we have sorted arrays. The state of array is not known. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
