Write out your answers for these questions on a separate piece of paper.
Question #1: A stack is a sequence container allows inserts at the ____________ and removal at the ____________ of the sequence.
Question #2: A queue is a sequence container allows inserts at the ____________ and removal at the ____________ of the sequence.
Question #3: A stack is implemented with the ____________ class in the ____________ library; a queue is implemented with the ____________ class in the ____________ library.
Question #4: A stack is known as a "first in, ____________" container.
Question #5: A queue is known as a "first in, ____________" container.
Code #1:
Write a declaration for a stack of int
s named values
.
Code #2:
Write a declaration for a queue of double
s named moreValues
.
Code #3:
Write statements that inserts the value 3 to values
and to
moreValues
.
Code #4:
Write an expression that evaluates to the top value of values
; write an expression that evaluates to the front value of
moreValues
.
Code #5:
Write expressions that test if value
and moreValues
are empty.