Kth smallest number using quick sort