0.4: Algorithm is now O(n log n).