Quicksort O(nlogn) working perfectly for small n