CSC 216/s08/gracefully claim

From Expertiza_Wiki
Jump to navigation Jump to search

Selection Sorting

The problem

Uses students and a deck of cards to help teach how the selection sort technique works.

Participants and props

This exercise will work best with 7 to 15 students, although it can be done with any number of them. It will also require a deck of playing cards. Any set of objects with inherent value can be used in place of the cards (e.g. the students name's, letters, money, etc.) In addition, a tennis ball (not old or dirty) will be needed to pass between the students.

The script

Select the students that are participating in the exercise and have them come to the front of the classroom and stand in a line. Shuffle the deck of cards and deal one card out to each student.

The first student is handed the tennis ball. Each person down the line compares the value of their card with the value of the ball holder's card. If a student has a card lower in value than the ball holder's, the ball holder should toss the ball to them. Once the end of the list is reached, the student holding the ball trades places with the first person in the line. That student should stand slightly away from the rest of the "list" and will not participate in the remainder of the sorting process. This student should pass the ball to the next person in line.

Repeat this process, starting with the first unsorted person in the list. Each iteration, the person with the lowest value trades with the first unsorted person on the list. The exercise ends when the entire list has been sorted.