Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Live sorting algorithms

In this activity, the students receive cards with numbers and demonstrate sorting algorithms by sorting themselves.

Parameters:
Duration: 20 minutes
Participants: 12–24 students
Instructors: 1 teacher
Class: anywhere with enough space to move around
Resources: printed cards with numbers
Prerequisites: the concept of a variable, list, algorithm

Learning outcomes

  • Understand the principle of selected sorting algorithms (in this case, Bubble Sort and Selection Sort).
  • Code the algorithms in a chosen programming language.

Setup and preparation

  • Print the number cards and cut them. Use one-sided printing.

Activity overview

  1. Briefly explain how Bubble Sort works.
    • [Modification] Instead of you explaining the algorithms, you can select one student from each group who will become a 'captain' of his/her group and brief the group about how the algorithm works (essentially peer tutoring).
  2. Divide the whole class into two roughly even groups, A and B, each with at least 6 people.
  3. The members of the group A will act as variables in an unsorted list. Every student from the group A randomly draws one number and lines up in front of the class showing his/her number to the class. Check quickly that the order is unsorted and that it will allow demonstrating the algorithm adequately.
    • [Optional] Mark the places on the floor for each 'variable' with a tape or chairs, at least for the first and the last element of the list.
    • [Modification] You can have the students hide their number cards to prevent someone from 'cheating' and looking at all the numbers at once. The 'processor' will have to ask the student what his/her number is, simulating reading of only one value at a time.
  4. Select a volunteer from the group B who will act as a 'processor' and will try to sort the 'variables'. Remind him/her that only one value can be processed at the time, as people tend to look at all the numbers and sort them in their head.
    • [Modification] The 'processors' from the group B can change after each step of the algorithm.
  5. Check on the progress of the group B. If the current 'processor' makes a mistake, encourage other students from group B to correct him/her.
  6. When the list is sorted, swap the groups (so that the 'variables' become 'processors' and vice versa) and perform the same activity for Selection Sort.
  7. When the class understood both algorithms, have each student individually decide which algorithm (s)he finds easier and let him/her code it. Leave the other algorithm as a homework assignment.

Tips and tricks

  • You can modify this activity so that group A has to demonstrate the algorithm without words while group B watches and then has to execute the algorithm again.

Related material

  • Wikipedia has an excellent comparison and explanation of various sorting algorithms.

Author

Michaela Pokludová, Valdemar Švábenský, 2016.