Lab 00
Sorting Unplugged
Objective:
Find a partner and then create an algorithm that will sort 7
playing cards from smallest value to the largest value. Write the algorithm in
pseudo code.
Materials:
Set Up:
- Shuffle the cards
- Lay the 7 cards out from left to right all face down as
shown. The numbers indicate positions (Computer scientists always start
counting from 0).

Guidelines for the Algorithm:
- The algorithm has to be systematic and repeatable on any
set of cards that will result in the cards being ordered (0 location being
the smallest and location 6 being the largest).
- You can only observe (flip over) at most two cards at a
time
- You may swap cards using their positions (0-6)
- Assume face cards are as follows
- Jack = 11
- Queen = 12
- King = 13
- Ace = 14
- Assume suits (Clubs, Hearts, Spades, Diamonds) does not
contribute to the value of the card
- You can use phrases like “Go to step <Insert Step
Number Here>”
Example (Bad Example in Comic Sans):
- Flip over the
card at position 0
- Then flip over
the last card
- If the first
card is bigger than the other one then swap the cards
- Otherwise go to
step 5
- Wait go to step
2 I think
- This step will
never be reached, so let’s just hope it was sorted from the beginning
Lab Report Questions:
- Does your algorithm work for any number of cards? If not
describe how it can be altered to accommodate this.
- If we were sorting cards, as before, from the smallest
value to the largest value then describe how the cards would have to be
ordered that would take the longest time to sort?
Finally:
Upload the text document to the dropbox