On Tue, 24 Apr 2012 13:02:52 -0700, Sophia wrote:
> I understand the overall algorithm but my problem is that why should we
> search for 'A[i] - x' because the sum of 'A[i] - x' and 'x' is A[i].
You should be searching for x-A[i], as the sum of A[i] and x-A[i] is x.
Searching for A[i]-x would make sense if you were searching for two
elements whose *difference* is x.