In Class: Week 10 Wednesday:
Sorting


Before you sit down:

  1. Get a playing card from me

  2. Find the student with the matching playing card and sit next to him/her.

  3. If there is not yet such a student, sit someplace with an empty seat next to you for your partner to sit when s/he finds you.

Developing a Sorting Algorithm

You and your partner will get 8 unique playing cards, and together you are going to use these to come up with a sorting algorithm.

Your algorithm should be written as steps on paper, and must be based on the following two operations on lists only:

  1. Compare two values in a list (using any of the relational operators)
  2. Swap two values in a list (e.g. swap the value in bucket i with the value in bucket j)

Use the cards to help you come up with your sorting algorithm, and try your algorithm out on the cards to see if it works.

Once you have a sorting algorithm, demonstrate it to me or one of the ninjas.

Next think about the number of steps it takes your algorithm to sort a list of n values.