10 Ways to Teach Computing Using a Deck of Cards

Compiled by Jessica Dickinson Goodman, Susan H. Rodger, and Katy Dickinson for the Notable Women in Computing Playing Card Kickstarter, 2014 – 2015. Download and freely print the pdf here.

Arrays

1. “Shuffle is a great algorithm for learning about arrays. I also use this big deck of cards that I picked up to illustrate different sorts. The cards go in the tray of the whiteboard and I move them around based on the sorting algorithm. I can also hand out sub-portions of the deck and ask groups of students to also do the sorts.” — Briana Morrison

Classes and Objects

2. “I use them a lot for introducing classes and objects. It also then allows me to do a lot of programming assignments based on that idea […] I was originally inspired by Richard Enbody’s collection of Python programming assignments that had solitaire variations. It’s amazing how many assignments you can come up with once you have a Card and a Deck class. Of course some games are more fun that others.” — Arvind Bhusnurmath

Computational Thinking

3. “I give a deck of cards to groups of three students. They remove a card from the deck and set it aside without looking. One person gives instructions to another in order to find the identity of the missing card (they can only look at the remaining 51 cards). The third person records the instructions. After they complete this, they pass their instructions to another group, which tries to use the instructions to repeat the process.” — Stephen Hughes

Cryptography

4. “My first year of Java at Carnegie Mellon included an assignment to recreate the Pontifex solitaire cypher from Neal Stephenson’s Cryptonomicon, which is a secure analogue code. It was a deeply nerdy and exciting introduction to cryptography.” — Jessica Dickinson Goodman

Linked Lists

5. “[G]ive an assignment where students are required to maintain a linked list in sorted order. (The code given in class and in the textbook adds and removes items at a specified position; they have to figure out how to add in relative order.) For some students who have difficulty visualizing the algorithm […] take some of the numbered playing cards (2-10) and place them in sorted order on my desk, and then ask them to figure out where another card should be inserted. Usually, that helps them see what kinds of comparisons are needed to insert in-order.”—Jim Huggins

Model a Deck of Cards

6. “‘Five Card Stud Simulation’ has the students analyze the probabilities of getting various poker hands in a 5-card stud poker game.” — Victor Norman

Sorting

7. “I have used playing cards as an excellent tangible device for teaching sorting methods in CS 2. I put students in teams of 2 and gave each team 8 or so cards. I then had them walk through insertion sort, selection sort, merge sort, and quick sort. It seemed to be very effective!” — Kiri L Wagstaff

8. “[T]each sorting and sometimes searching, with students holding playing cards acting as an array, and other students acting as the program, with the stipulation they can only ask two ‘array’ students at a time to show their cards, and to ask two ‘array’ students to swap places.” — Wayne Pollock

9. “[T]ake a small number of cards, split the pile in half, hand the two halves to students and ask them to (‘recursively’) sort the decks, then perform the merge operation live in front of them.”—Jim Huggins

10. “I regularly use playing cards to explain sorting algorithms, although I use a giant deck (nearly 8.5×11). I use face-up vs face-down to emphasize (a) that the computer can only look at a couple of values at once or (b) some subset of the cards, e.g., the already-sorted region in insertion sort. For recursive sorts, parts of the deck can be handed out to students to demonstrate the running these algorithms in parallel.” — Peter Drake

Bonus: Deal out the cards to a class and use the cards to call on students. It helps randomize cold-calling. — Kelly Shaw and others

*Most of these great ideas came from educators who shared them. Full sources and a dozen more examples and options here: http://www.cs.duke.edu/csed/wikipedia/cardsusing.html