Update 2024 Already Passed
Why are stacks, queues and priority queues more abstract than arrays? - Answers ...
What are stacks allowed access to? - Answers ...
Use the postal analogy to describe stacks. - Answers ...
Explain stacks using the work day analogy. - Answers ...
What is the "push"? - Answers Placing a data item on top of the stack.
What is "popping"? - Answers Removing a data item from the top of the stack.
Explain LIFO - Answers Last-In-First-Out. A stack is a LIFO storage mechanism because the last item
inserted is the first one to be removed.
What is "peek"? - Answers It allows the user to read the value at the top of the stack with out removing
it.
Explain how you would create an algorithm that matches delimiters on the stack. Include errors in your
explanation. - Answers 1. Read the characters from a string one at a time.
2. Find and place the opening delimiters on the stack one at a time
3. When the program reads a closing delimiter from the input, pop the corresponding opening delimiter
from the top of the stack
4. If the delimiters are not of the same type an error will occur, telling us that the string is missing either
an opening or closing delimiter. If there is no opening delimiter on the stack an error will occur.
What happens to non delimiter characters? - Answers They are not inserted onto the stack; they are
ignored.
Whatever you can do to manipulate the data storage structure becomes our: - Answers Methods.
What is the difference between a stack and a queue? - Answers In a queue the first item inserted is the
first to be removed (FIFO). In a stack the last item inserted is the first to be removed (LIFO)
Where does the term queue come from? - Answers It is a British reference to waiting in line. Fist in, first
out.
Unlike a stack, the items in a queue don't always: - Answers extend all the way down to index 0.
How is "peek" different in a queue? - Answers It "peeks" at the value of the item at the front of the
queue without removing it as opposed to the last value in a stack.