| | | + | | ( | bottom |___*___|
Now, suppose that you read and process the 11th symbol of the input. Draw the stack for the case where the 11th symbol is:
A. A number:
B. A left parenthesis:
C. A right parenthesis:
D. A minus sign:
E. A division sign but change the algorithm to the general case (not fully parenthesized):
2. (4 points) Entries in a stack are "ordered". What is the meaning of this statement?
A. There is a first entry, a second entry, and so on.
B. A collection of Stacks can be sorted.
C. Stack entries may be compared with the compareTo method.
D. The entries must be stored in a linked list.
3. (4 points) Which of the following stack operations could result in stack underflow? A peek B. pop C. push D. Two or more of the above answers.
4. (4 points) Suppose we have an array implementation of the stack class, with twelve items in the stack stored at data[0] through data[11]. The CAPACITY is 42. Where does the push method place the new entry in the array? A. data[0] B. data[1] C. data[11] D. data[12]
5. (4 points) What is the postfix expression for the following infix: (a + b*(c - a) - d) A. d b c a - * a + - B. a b c a d - - * + C. a b c a - * + d - D. None of the above.
6. (4 points) In the array version of the Stack class, which operations require linear time for their worst-case behavior? A. is_empty B. peek C. pop D. push when the stack is below capacity