Believe or not, it’s O(n), not O(nlogn). Click here. From 1998, awsome.