I have been looking for a quick and easy explanation on Quick Select and stumbled upon this. It's quick and easy to follow, but there's a part which I am not following quite well:The uploader is sorting the following array using the 4th smallest element2 6 5 1 4 9 3, pivot is 2 and last element is 3We rearrange, the array is now:2 1 5 6 4 9 3, 5 is greater than 3 so we swap them2 1 3 6 4 9 5We go to n/2 and see the right half.6 4 9 5, pivot is 5Then the sub-array is rearranged as follows:4 5 6 9Shouldn't this be 4 5 9 6?Or is it just putting and shifting?
Quick Select explanation
sorting;quicksort