Return to Question

Tweeted twitter.com/#!/StackCompSci/status/394489057113571329
2 deleted 15 characters in body

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 element

2 6 5 1 4 9 3, pivot is 2 and last element is 3

Since 1 is the 4th smallest elementWe rearrange, the array is now:

2 1 5 6 4 9 3, 5 is greater than 3 so we swap them

2 1 3 6 4 9 5

We go to n/2 and see the right half.

6 4 9 5, pivot is 5

Then the sub-array is rearranged as follows:

4 5 6 9

Shouldn't this be 4 5 9 6?

Or is it just putting and shifting?

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 element

2 6 5 1 4 9 3, pivot is 2 and last is 3

Since 1 is the 4th smallest element, the array is now:

2 1 5 6 4 9 3, 5 is greater than 3 so we swap them

2 1 3 6 4 9 5

We go to n/2 and see the right half.

6 4 9 5, pivot is 5

Then the sub-array is rearranged as follows:

4 5 6 9

Shouldn't this be 4 5 9 6?

Or is it just putting and shifting?

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 element

2 6 5 1 4 9 3, pivot is 2 and last element is 3

We rearrange, the array is now:

2 1 5 6 4 9 3, 5 is greater than 3 so we swap them

2 1 3 6 4 9 5

We go to n/2 and see the right half.

6 4 9 5, pivot is 5

Then the sub-array is rearranged as follows:

4 5 6 9

Shouldn't this be 4 5 9 6?

Or is it just putting and shifting?

1

Quick Select explanation

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 element

2 6 5 1 4 9 3, pivot is 2 and last is 3

Since 1 is the 4th smallest element, the array is now:

2 1 5 6 4 9 3, 5 is greater than 3 so we swap them

2 1 3 6 4 9 5

We go to n/2 and see the right half.

6 4 9 5, pivot is 5

Then the sub-array is rearranged as follows:

4 5 6 9

Shouldn't this be 4 5 9 6?

Or is it just putting and shifting?