You are Here: Home >< Maths

# Quick sort - D1 - isn't this wrong? watch

1. On the mark scheme of the June 2008 paper (AQA). Using pivot being the first letter. It creates a pivot on one letter on the 5th pass even though it is in the middle of two old pivots.

I lost a mark but isn't this silly because there is nothing to compare it to as it is already obviously in the correct position.

2. Nope, the mark-scheme is correct - when you do quick sort you need to pivot and then fix a value which is as of yet unfixed, even though you can see it is the only value in its sub-list.
3. (Original post by Kestrel_Lover_Sophie)
Nope, the mark-scheme is correct - when you do quick sort you need to pivot and then fix a value which is as of yet unfixed, even though you can see it is the only value in its sub-list.

So even if it is comparing itself it counts as a comparison?
4. (Original post by Dave129)
So even if it is comparing itself it counts as a comparison?
Yes
Edit: wait no....that's not right. The way I was taught it, we put | on both sides of the pivots so it kinda automatically included ones between two pivots.
5. (Original post by Dave129)
So even if it is comparing itself it counts as a comparison?
Yes, the list is only sorted once every item has been used as a pivot and fixed in place.
6. (Original post by Chrosson)
Yes
Edit: wait no....that's not right.
eh?
7. (Original post by starofale)
eh?
I edited again
e.g. with 2 3 1 > 2 1|3| > |1|2|3| done, despite not pivoting the 2
8. (Original post by Dave129)
So even if it is comparing itself it counts as a comparison?
Not sure about whether you'd count it if you were making a tally of total comparisons needed for the sort.
I just know you need to write down another line of working to show that you have made that value a pivot and then fixed it...

Why does D1 make me so inarticulate?
9. (Original post by Kestrel_Lover_Sophie)
I just know you need to write down another line of working to show that you have made that value a pivot and then fixed it...
Yes, this is what I was taught as well
10. (Original post by starofale)
Yes, this is what I was taught as well
I appear to have been taught differently.
Best to go by the mark scheme methinks.
11. So...

I think I got it sorted. You have to make sure you make every sublist one unit so you have to make the number/letter that is on it's own a pivot as well. When this happens it counts as NO comparisons. So in quick-sort you end up having all the numbers being a pivot in the end.

Thanks,
David.

TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: January 17, 2010
Today on TSR

Poll
Useful resources

### Maths Forum posting guidelines

Not sure where to post? Read the updated guidelines here

### How to use LaTex

Writing equations the easy way

### Study habits of A* students

Top tips from students who have already aced their exams