Sorting is a common problem in computer science and one which has many solutions. Over the course of three or four lessons we shall look at a number of different approaches to the problem of sorting. The first algorithm we will look at is known as insertion sort. This algorithm had its inspiration on how humans sort a hand of cards in their hand. Let's consider the human version before we look at the computer science version.

Consider the cards above. They are currently not in any order and in a players hand. They must put the cards in order to make the game easier for themselves. The first thing they will do is remove the lowest value card and put hold onto in their right hand.

The 2 of spades will then be inserted into the correct position in the left hand.