Lab 11 -- Introduction to Abstract Data Types & Stacks

Answer Sheet

Exercise 1

It is now time to review what we know about stacks. Answer the following:

A. Which stack element(s) can be accessed?

B. Name three operations which can be performed on a stack.

C. A stack is called a LIFO structure. What does this mean?

D. Give an example of an application of the stack.

Exercise 2

Show the array s.elements[] after the following operations have all been completed: (Draw the final picture of s.elements[] and show the value of s.top)

     1. s.push(20)
     2. s.push(51)
     3. s.pop()
     4. s.push(43)
s.elements[]
N-1
.. ..
2
1
0 92
s.top =

Exercise 3

{ Script }

Exercise 4

{ Script }

Exercise 5

{ Script }

Exercise 6

{ Script }

Exercise 7

{ Script }

Exercise 8

{ Script }

----- End of Lab 11 - Introduction to Abstract Data Types & Stacks -----
Complete the Exercises on the Answer Sheet.
Turn in the Answer Sheet and the printouts required by the exercises.