CS111 C++ Practice Quiz #6
Stacks and Queues
Answers
- Queue
- Stack
- push()
- pop()
- int size()
- bool empty()
- top()
- push()
- pop()
- int size()
- bool empty()
- back()
- front()
- prefix notation places binary operators before both of their operands: - x 4
- postfix notation places operators after both of their operands: x 4 -
- infix notation is used by C++ for expressions. Operators are placed between their operands: x - 4
- 66
22
2
- 10 an infinite number of times. top() simply copies the top element of the stack.
Use push() to remove an element from the stack.
- 10
9
8
7
6
5
4
3
2
1
-
Bobo
Bobo
Billy
Bobo
Billy
Suzy
Billy
Suzy
Billy
Suzy
Ari
Suzy
Ari