Algorithm 2 Two Sum
Input: An array representing a set of integers and an integer .
Output: Whether there is two elements in whose summation equals .
1:MergeSort() //
2:
3:
4:while do
5:if then
6:
7:else if then
8:
9:else
10:return true
11:end if
12:end while
13:return false