http://ideone.com/D5W2y

On Oct 10, 10:18 am, Harshal <[email protected]> wrote:
> Design an *O(n)*-time algorithm that, given a real number *x * and a sorted
> array *S* of *n * numbers, determines whether or not there exist two
> elements in *S* whose sum is exactly *x *.
>
> since array is already sorted, doing binary search for x-S[i] ,for each
> element indexed at i will give a nlogn solution. How to get O(n) solution??
>
> --
> Harshal Choudhary

-- 
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.

Reply via email to