Checking if there are 2 elements in an array that sum to X in O(n lg n)
Sort the array say ascending order- Takes O(nlogn)

Keep two pointers in the array say fingers. Finger f1 at the first element and finger f2 at the last element. 

Sum the elements to get f1+f2:
if f1+f2  == X you have found your solution
else if f1+f2 > X decrease f2 to point to the element to its left
else increase f1 to point to the element to its right

This step will take O(n) making the overall cost O(nlogn)

This solution is also referred to as the finger pointing solution. Can be used in any sorted collection where you can traverse in both the direction for eg in trees.