CSC 216/s08/wholesome discipline
Stacks & Queues
The problem
In this exercise, students will learn the difference between stacks and queues, mainly which end to push and pop from. In a stack, the items are added and removed from the top of a stack (LIFO); where as in a queue the items are added to the end and removed from the front (FIFO).
Participants and props
For this exercise about seven students will be needed to act as objects. The props will be plates, and candy.
The script
Each participant will be given a plate to write their name on, and will then stack them in a pile (Push).
Afterwards, a certain name will have to be found, and the only way to get to it will be by taking off the top plate (Pop), until the desired name is found. This demonstrates the last in first out concept of a stack.
Then another group of students will demonstrate how queues work. Each student will line up to get a
piece of candy. The first person to line up will be in the front and everyone else in the line will line up behind him (Push). Once the first person gets his piece of candy and leaves (Pop), the next person in line will then be able to get a piece of candy. This demonstrates the First in First out concept of a queue.
- side note the promise of candy will most definitely raise class participation.