Still quadratic. Implemented merge sort inside.