You may also like

problem icon

Route to Root

A sequence of numbers x1, x2, x3, ... starts with x1 = 2, and, if you know any term xn, you can find the next term xn+1 using the formula: xn+1 = (xn + 3/xn)/2 . Calculate the first six terms of this sequence. What do you notice? Calculate a few more terms and find the squares of the terms. Can you prove that the special property you notice about this sequence will apply to all the later terms of the sequence? Write down a formula to give an approximation to the cube root of a number and test it for the cube root of 3 and the cube root of 8. How many terms of the sequence do you have to take before you get the cube root of 8 correct to as many decimal places as your calculator will give? What happens when you try this method for fourth roots or fifth roots etc.?

problem icon

Divided Differences

When in 1821 Charles Babbage invented the `Difference Engine' it was intended to take over the work of making mathematical tables by the techniques described in this article.

problem icon

Tournament Scheduling

Scheduling games is a little more challenging than one might desire. Here are some tournament formats that sport schedulers use.

Sorted

Stage: 5 Challenge Level: Challenge Level:1

Take some numbered cards; between ten and twenty should be enough (you could use a suit from a pack of playing cards).
Shuffle the cards.
Then organise your deck of cards into numerical order.

What method did you use to put them in numerical order?

Can you think of any other ways you could have sorted them?

Here are some different sorting algorithms you could try. You may find it easiest to lay the cards out in a line to keep track of their order and see what's happening at a glance.

Bubble Sort

Compare the first two cards. If they are in the wrong order, swap them round. Then compare the second and third card. If they are in the wrong order, swap them round. Keep going through the pack. When you have finished, keep the cards in the new order and repeat the process from the beginning of the pack.
Repeat until you get all the way through the pack without doing any swaps. The cards are now sorted.

Shuttle Sort

First pass: compare the first two cards. Swap them if necessary.
Second pass: compare the second and third cards. Swap them if necessary, and then compare the first two cards again, and swap if necessary.
Third pass: compare the third and fourth cards. Swap them if necessary, then compare second and third, swap if necessary, then compare first and second, then swap if necessary.
Continue in the same way for the rest of the pack.

Selection Sort

Go through the pack until you find the Ace. Swap it with the first card. Then go through the pack until you find the Two. Swap it with the second card. Then go through the pack until you find the Three. Swap it with the third card. Repeat with the rest of the cards.

Insertion Sort

Put the first card down. Take the second card, and put it to the right or to the left of the first card, depending on whether it's higher or lower. Then take the third card and place it correctly relative to the first two cards, making a space if necessary. Take the fourth card and place it correctly relative to the first three cards, making a space if necessary. Keep going until all the cards are in order in the new pile.

Quick Sort

Take the first card of the pile. Sort the rest of the pack into numbers smaller than and numbers bigger than the number on the first card. Put the first card down between these two sub-packs. Then sort each sub-pack of cards by taking the top one and sorting the rest into two sub-packs in the same way. Keep going until there are no sub-packs with two or more cards.


Try each algorithm a few times, and keep a record of how many 'moves' or 'swaps' you do. You could work with a friend and 'race' against each other to see who sorts their pack the quickest.

If you are struggling to make sense of the written algorithms, here are some videos showing each algorithm being performed.

Here are some questions to consider:

  • On average, which algorithm did you find to be quickest?
  • What is the 'worst-case scenario' for each algorithm?
  • How long would it take in the worst case?
  • Which would you choose if you had to keep the cards in a pile rather than laying them out?
  • Which would you choose if you only had a limited amount of desk space to arrange the cards on?
If you know a little about computer programming, think about how might you instruct a computer to perform these algorithms. Which ones would be quick to perform? Which ones would use a lot of space?

Notes and Background

One way to get a sense of how sorting algorithms work is to watch animations, such as the ones on this website.

Thanks to Margaret for testing this problem.