1
Quiz 2 Solution
CpE 360 – Computational Algorithms and Data Structures
Instructor: Ashish Patel
October 26, 2006
(Close notes, close books. Circle on your answers)
1.
Assume that numbers 9, 3, 118, 24, 11 are pushed on a stack, three numbers are
popped, then numbers 6, 34 are pushed on the stack, and one number is popped. What
remains on the stack?
Answer: 9, 3, 6
2.
Assume that numbers 11, 3, 55, 24, 9, 29 are pushed on a stack, two numbers are
popped, then numbers 6, 34 are pushed on the stack, and three numbers are popped.
What remains on the stack?
Answer: 11, 3, 55
3.
If numbers 3, 22, 4, 51, 37 are inserted in a queue, which one will be removed first?
Answer: 3
4.
If numbers 10, 22, 33, 48, 11 are inserted in a queue, two numbers are removed, then
numbers 18, 67 are inserted in the queue, and three numbers are removed. What
remains in the queue?
Answer: 18, 67
5.
If numbers 10, 22, 35, 47, 15, 11 are inserted in a queue, three numbers are removed,
then numbers 19, 44, 32 are inserted in the queue, and two numbers are removed.