Interactive Parallel Sorting

Line Dancing

(or the Even-Odd Transposition Sort)

Credit for this idea goes to Dr. Paul Gray, University of Northern Iowa.

In this section you will learn the basic moves of the high-low turnaround dance. This dance is so phenomenal! So phenomenal in fact, that there has yet to be music of sufficient quality to accompany the moves. It is a dance that transcends music's current capabilities. We'll just have to make do.

To begin, grab a number. Then grab a partner and form a single line. (Your partner will change as the dance progresses, so don't get too attached!!)

Face your partner. If you don't have a partner (i.e., you are the odd man out) then stand at the end of the line facing away from the rest of the line.

Now, everyone turn 90 degrees clockwise. Those facing the front of the room are the "highs." Those facing the back of the room are the "lows".

 

Repeat this dance {

} Until numbers are sorted!

End persons will not have partners at times. In the event that you find yourself without a partner, shout a big, "Yaw Hee!" It's not crucial to the dance but it does give you something to do.

 

Questions for discussion

  1. How many iterations of the dance do you have to perform until the numbers are sorted? What is the best case? What is the worst case? How about on the average?

  2. Think about what you would need to do to implement this algorithm. What efficiencies and inefficiencies would be present in the implementation?

 

Winner's Choice

Credit for this idea goes to Dr. Paul Gray, University of Northern Iowa.

Congratulations! You have been selected at random as a final-round prize winner in the very successful "Hog Wild Sweepstakes".

Unfortunately, the firm that was hired to oversee the integrity of the seepstakes process was only able to provide a list of winners, but there is no ranking of the winners.

In order to sort this out, please report to the winner's area to receive your prize in the form of prize money. All prizes will be awarded, and all final-round participants are guaranteed to receive some prize money. Prizes will be awarded as follows:

Instructions

  1. Report to the winner's area and form a line.

  2. The prize selections will be passed through this line starting with the first person. Prizes will be listed given their suggested retail price.

  3. You may retain possession of only one prize card at a given time. When all prizes have been claimed, you will be awarded the suggested retail price, in cash, for the prize that you have selected.

  4. Undesirable prize selections must be relinquished to the next winner in the line.

End of Instructions

Good luck in claiming your prize!!

 

Questions for discussion

  1. How many messages must be exchanged until the numbers are sorted? What is the best case? What is the worst case? How about on the average?

  2. Think about what you would need to do to implement this algorithm. What efficiencies and inefficiencies would be present in the implementation?

King of the Hill

This is a simple exercise in who can beat up who (figuratively!). Have everyone in the class stand in a single line with everyone facing forward. Each person should follow the following instructions.

Repeat these steps {

If you are taller than the person in front of you, then (gently!) tap that person on the shoulder and say, "Excuse me, I need to be in front of you," and then step in front that person.

} until sorted.

 

Questions for discussion

  1. How many messages must be exchanged until the class is sorted by height? What is the best case? What is the worst case? How about on the average? How can you know when the algorithm is complete?

  2. Think about what you would need to do to implement this algorithm. What efficiencies and inefficiencies would be present in the implementation?

 

Enjoy!