- The goals of these activities are to:
- Introduce algorithms for sorting arrays of numbers or binary search.
- Discuss efficiency and algorithms in general
- Get students moving around the classroom.
-
Example of binary search activity:
-
Give the class a phone book.
-
Tell the students to pick a business from the phone book, then leave the room so they can keep it a secret from you.
-
Come back into the room and tell students that you will find the business only by asking a series of yes or no questions.
-
Now, ask those yes or no questions, like does the business start with a letter between A and M.
-
-
Once you found the business, ask students how long it took to find the correct phone book entry.
- Discuss if we could guarantee that we could guess the business within a particular number of guesses.
-
- Example of Sorting Activity
- Get a set of students volunteers
- These students will be elements in an array.
- Give each student a number to hold
- Instruct students to hold the number such that they cannot see the number while the other students in the class can.
- Have the rest of the students in the class devise a way to sort the volunteers (array elements).
- Let students give specific instructions.
- For example, "Alice and Bob swap spots."
- If students don’t know each others names, make sure students have a way to direct the volunteers without calling the volunteers by the number their holding.
- Let students give specific instructions.
- If students’ instructions approximate a sorting algorithm, tell them the name of the sorting algorithm they just reproduced, the details of that sorting algorithm, and then discuss its efficiency.
- Note from Mark Zarb: My students often start with algorithms like bubble sort, though they don’t know it by that name until I share that with them.
- Additionally (or alternatively), show the Folk Dancing Sorting Algorithms videos to motivate, or finish the lecture
- Get a set of students volunteers