Algorithms Worksheet 3
Algorithms Worksheet 3
1.
What are the last 2 names after the first pass? Amelia and Sophie
What are the first two names after the second pass? Jessica and Isabella
What are the third and fourth names after the third pass? Isabella and Isla
What are the seventh and eighth names after the fourth pass? Lily and Olivia
What are the fourth and fifth names after the fifth pass?
What are the first two names after the sixth pass?
2. Use what you have done with the name cards to write an algorithm to perform the steps
in a bubble sort
1
3. Task 2: Insertion sort
1.
Lay out the girls’ names cards in the sequence of numbers 1, 2, 3… 10
On the first pass, Sophie is examined. The card is already in the correct place, so now you
have
Lily, Sophie, Jessica
On the second pass, put Jessica into the correct position.
On the third pass, what is the next name to be placed in the correct position?
After the fourth pass, what are the first 5 names in the list?
After the sixth pass, what is the first name in the list?
2. Use what you have done with the name cards to write an algorithm to perform the steps
in a Insertion sort
2
Task 3: Merge sort
1. Use the first girls’ name cards. Lay them in a row in numerical sequence.
3
2.Use what you have done with the name cards to write an algorithm to perform the steps in a
merge sort