This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 15-121 FALL 2009 [CORTINA]LAB 5In this lab, you will implement a new version of the ArrayStack class and then test it with the applications given in lecture. EXERCISESDownload the Stacks.zipproject file discussed in lecture. 1. Create a new class named ArrayStack2that implements a stack where the top of the stack is always stored in position 0 of the array. When an element is pushed on this stack, the elements on the stack must be shifted to make room for the new element. Likewise, when an element is popped from this stack, the elements on the stack must be shifted the opposite direction to fill in the gap left by the removed element. Your class should implement the LIFOStackinterface so it must include all of the required methods specified by that interface in the project. Test your ArrayStack2class by changing the PostfixEvaluatorclass so that it uses a stack of type ArrayStack2instead of ListStack....
View Full Document
- Spring '09