Students in each row in a classroom cooperatively sort a list using recursion.
| Parameters: | |
|---|---|
| Duration: | 5-10 minutes |
| Participants: | 6–X students |
| Instructors: | 1 teacher |
| Class: | tables |
| Resources: | printed sticky note frames, sticky notes, and a marker |
| Prerequisites: | knowledge of lists and integers |
- Usage of a recursive algorithm with no prior knowledge of recursion.
- Ability to realize how recursion works from the program execution point of view.
- Prepare sticky note frames
- Print
(M // 3) + 1papers, whereMis the number of rows you have. - Cut each paper to three strips containing
Nsticky note frames. - Place a sticky note with an integer into each frame on each strip (choose arbitrary integers).
- Provide the following instructions to the students -- either prepare a copy for each student or display a slide (in such case, there is an example slide available and an example picture):
- if anyone asks me for the help:
- if the list has only one element
- return it to the caller with words: "Here you are"
- else
- take the sticky note with the greatest element from the list and keep it
- ask your neighbour to the help you sort the rest of the list with words: "Please, sort this list for me"
- if the list has only one element
- if anyone returns you a list:
- place your sticky note at the end of the list
- return your list to the caller with words: "Here you are"
- Tell the students that from now on, they are not allowed to talk except following the provided instructions (now it is suitable to read the instructions or just let the students to do it on their own).
- Visit each row and give your prepared strip to the first student with words "Please, sort this list for me".
- Now just wait until each of the lists returns to you.
- If the list gets stuck at some place, try to consult with the student what is unclear about the instructions.
- If there are some shorter rows formed in the room, just remove the suitable number of sticky notes from the paper.
- It can be useful to first check the size of your sticky notes before printing the papers (default size is 4x5cm).
Matej Troják, 2019