Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Sorting Algorithms
Sorting Algorithms
Something as simple as sorting a list of
1st Iteration
8
in to ascending order.
The first thing to do is to
compare the first two numbers
to see if they are the correct
way around.
In this case they are not so we
change them.
Now repeat the process on the
next pair of numbers, and so on.
The process (or iteration) stops
when all the pairs have been
compared.
The final line shows the State of
the order after the first iteration.
7th Iteration
1
lists.
Two of them are easily dealt
with because both lists are
single digits.
So these can be fixed in the
final list.
The 7 is now the pivot in the
last list.
Make it permanent.
The 6 moves across.
We can fix the 7 in the final
list.
Now all thats left is the 6 so
we can fix that too.
Edexcel
Quick Sort Algorithm
8
5
1