CSC 216/s08/perpetual motion

From Expertiza_Wiki
Revision as of 15:28, 27 March 2008 by Jwgorham (talk | contribs) (→‎The Name Game: A Linked List Exercise)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Formatting Resources

Formatting Help Guide from MetaWiki

The Name Game: A Linked List Exercise

It's the classic name game with a Java twist

The problem

This exercise is designed to teach students about how linked lists work. The game is played much like the classic name game in which participants must state their name as well as the names of everyone who went before them. Each student represents a node that knows his/her first and last name. All of the students are arranged in rows with the same amount of people in each row.

Participants and props

Any number of students can participate; however, it is ideal to have no more than thirty people participating at a time as too many participants will make the exercise very long as well as make it very hard for participants to remember all previous participants' names.

The script

All participants (or nodes) start off with their one hand in the air. A node with a hand up means it is pointing to null. A node is randomly chosen as first. This node states his/her name and then points to another node that is not in their row. The pattern continues until only one node remains with their hand up.