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:

  1. Shuffle the cards
  2. 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:

 

Example (Bad Example in Comic Sans):

  1. Flip over the card at position 0
  2. Then flip over the last card
  3. If the first card is bigger than the other one then swap the cards
  4. Otherwise go to step 5
  5. Wait go to step 2 I think
  6. This step will never be reached, so let’s just hope it was sorted from the beginning

 

Lab Report Questions:

 

  1. Does your algorithm work for any number of cards?  If not describe how it can be altered to accommodate this.
  2. 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