How can I write an algorithm to check if the sum of any two numbers in an array/list matches a given number with a complexity of nlogn?
nlogn
Depends If you want only one sum O(N) or O(N log N) or all sums O(N^2) or O(N^2 log N). In the latter case better uses an FFT>