Quick Sort with O(NlogN)