Suppose you are given a set P of integers and another integer x. We wish to use a O(n*lg n) algorithm to decide whether there are 2 integers in P whose sum equals to x. Show your algorithm. You can use pseudo code or verbose description to explain your algorithm.
If you need to use any well known standard algorithm in your solution, you need not give details of that, just mention how that is helping you in devising solution for the given problem.
Note that there is no restriction on integers in set P and integer x, that is, we are not restricting ourselves to positive or negative integers.