Computing: Mr Barclay’s Playground Sorting Network
Year 7 Computing students at Bede's Prep School have been learning about algorithm design, as part of their work on Computational Thinking, and one of our recent activities included understanding how computers use "search and sort" techniques.
To give the children an understanding of the problem at hand, the students were initially challenged to see how quickly they could find the largest number, from a selection of 700, which were not listed in numerical order - not an easy task!
This exercise demonstrated the importance of sorting data first, in order to find items at either extreme. Computers use this method of sorting data extensively, but can only compare two numbers at a time. However, they are able to do this very quickly and processors can be combined into "sorting networks", where they solve comparison problems concurrently and achieve the goal even quicker.
To see how this works, the children worked in teams using a giant sorting network sketched onto the playground tarmac.
Here, they acted as computers themselves, moving through the network one stage at a time, comparing numbers with each other in order to sort themselves into order by the end.
Starting with a random order of numbers, the algorithm involved comparing their number with a partner at each comparing stage, and following the path to the left if they had the larger number, and to the right if they had the lower.
They saw how if they all followed the protocol accurately as a team, the network would sort any set of numbers into numerical order.
The children were challenged to sort the six numbers as quickly as possible, with timed competitions between teams, and practised sorting 2, 3 and 4 digit numbers using the network. They quickly saw, however, that if they did not work as one, stepping through the network together, the algorithm would collapse and they would have to start again!
This "unplugged" exercise, where the children learn how computers work without actually using a computer gives the children the chance to step back from the machine and consider how such technologies work in principle, before applying their understanding to tasks on the computer.
The children moved on to designing their own sorting networks, and were challenged to produce even more advanced networks capable of sorting a larger selection, and variety of data types into any order.