## Tangible Introduction to Stacks

After we spend a day getting back into a coding mindset in Computer Science, we’ll be starting a new unit over data structures. The first structure we’ll be looking at are stacks.

I’m reflecting on something that Dr. Sabrina McCullough used to tell us when she was leading our elementary math training sessions about the importance of introducing a new skill or concept using concrete / real-world / tangible examples.

I applied this when I introduced iterative structures such as for loops, while loops, and do while loops. My students can tell you that I had them walking in circles for a while, but they understood the difference between the types of loops before we ever coded anything!

To start, I am going to have the students tear a sheet of paper into 8 semi-equal pieces. They are going to answer the following questions in this order recording an answer on each piece of paper and stacking them one on the other face-down as they record their answers.

1. What is your favorite breakfast food?
2. What is your favorite junk food?
3. What is your favorite school holiday?
4. How old are you?
5. What grade are you in?
6. What month is your birthday?
7. What year is it now?
8. What is your favorite color?

Once the last question is answered, I will have them look at their small stack and ask them the following questions:

1. As you added a new item to your stack, where did you put it? (top, bottom, or middle)
2. If you needed to search through your stack for something, where would you start? (top, bottom, or middle)

Next, I will give each student a stack of 8 index cards. The cards will be randomly numbered with the exception of the 3rd card in each stack, which will have the number 25.

Before the students are given their cards, they will be given the rules:

• Do not do anything with the cards until you are told to do so.
• You can only have one card face-up at a time.
• You can only take from the top of the stack.
• If you perform any sort of calculation beyond a search on a card, that card is removed from the stack and “discarded”.

I will then walk them through a series of exercises with their stack of cards:

1. Write down the cards in the stack in order.
Return stack to original.
2. Search for the card with 25. How many cards were above it?
Return stack to original.
3. Take top card and multiply it by 10.
4. Search for the card with 25. How many cards were above it?
Return stack.
5. Take top card and multiply by 5.
6. Search for the card with 25. How many cards were above it?
Return stack.
7. Write down the cards in the stack in order.
Return stack.

Once this information has been recorded, the following questions will be asked:

1. How many cards can we interact with at a time?
2. What was the pattern each time you searched for the card with 25 on it?
(Answer = it was getting closer to the top)
3. Can we do any calculations with cards below the current top of the stack?