Login |
RegisterOver 34,630 Wishes Granted!
Stacks - Java Page Views: 336
|
1. Start reading Yertle the Turtle ¡V while reading emphasize the word stack when you hear it 2. When you are finished talk about why the stack of turtles fell over the first one in Mac left and the stack fell apart when the order of removing something didn¡¦t follow. 3. Pull out books/papers and stack then up ask which one do you remove first second etc until the stack is gone. 4. Take out the Lego blocks ¡V different colors and put them onto the Lego board- Make a big deal out of ¡§pushing¡¨ them onto each other . 5. Talk about you can only remove one block at a time and you want the red block how are we going to get it? What happens when the block comes off what sound does it make¡¨pop¡¨ 6. Repeat steps 4 and 5 a few times. 7. Add numbers to the Lego blocks then repeat steps 4 and 5 but with the numbers talking about order. 8. Talk to students about the Stack data structure in Java . 9. On the whiteboard create a Stack data structure and push and pop items on the stack. 10. Ask them to draw the stack every instruction. 11. Repeat step 9 and 10 until class is comfortable with the stack. 12. Hand out the worksheet on stacks. Closure Have the students create a program using stacks.- a. maze program b. postfix/prefix notation c. checking number of braces, quotes Include closure activity (include dialog and possible questions).
Discuss the advantages to using stacks vs other data structures Evaluation
Rubric: Correctness 50 points Stack Usage 20 points Readability/organization 20 points Algorithm 10 points |
|
Cross-Curriculum Ideas |
the stack programs can be related to any subject area history create a stack of reasons for a war
english creat a stack of words |
Follow-Up |
ƒÞ Create another program using stacks different than the one required
ƒÞ Have students create a program of their choice where a stack is used
ƒÞ Additional Stack Worksheets
|
Materials: |
Whiteboards, Short Throw Projectors, Worksheets |
Other Items: |
1 Yertle the Turtle Book by DR. Seuss 10 Lego Blocks 1 JCreator Software |
|
|
|
|