suppose the array is arr[];
set index start and end at the starting and ending of the array.
 sum=arr[start]+arr[end]
check if sum<value
increase start index by one
if sum>value
decrease end index by one
and repeat the process until start<end

time complexity is o(n).

am I clear to you??

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