One of the most important jobs a computer performs for us is sorting of data. Without sorted data our computer systems would be much harder to use.
Imagine:
trying to read through all your emails if they were in a random date order.
finding a friend’s telephone number if all you contacts were in a random order.
loading an app from your apps list if they were all jumbled up.
There are many different ordering systems we can use, common ones include:
alphabetical order
numerical order
date order
size order
Different sorting algorithms
There are many different algorithms(methods) for sorting lists of things. In the last task some people will have sorted the letters the fastest (most time efficient) or with the least number of swap (most effort efficient). Have a chat with the person next to about how they sorted out the list. What technique did they use? Whose algorithm was the most time / effort efficient?
In computer science we have many different sorting techniques, some are most efficient than others, some are simpler than others. Today we will be looking at:
Insertion Sort
Bubble Sort
Selection Sort
With the insertion sort algorithm, you go through each item in the list in turn and move to its correct position in the list. The algorithm is slow but simple.
The bubble sort algorithm works by sorting through the array in pairs. It starts at the left of the array and inspects the first two items. If the items are in the wrong order they are swapped around. The algorithm then carries on with the next pair along and so forth. When it reaches the end of the array it goes back to the beginning of the array and starts again. If it completes a full pass of the array without swapping any items it knows that the array is sorted.
You will be given by your teacher 8 plastic cups - each cup will need a number ( you will demonstrate each sort using the cups putting them into ascending order)
Replicate the sort as a group activity for each sorting algorithm based on height your group will need to be six or more people.
You will need to create an animation demonstrating each of the 3 sorts and explaining how they work.