F01MT2 - CET 230 Applied Data Structures Fall 2001 MidTerm...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CET 230 Applied Data Structures Fall 2001 MidTerm Exam 2 Name: 1. (10 points) Consider the usual algorithm to convert a fully parenthesized infix expression to a postfix expression. Suppose that you have read 10 input characters during a conversion and that the stack now contains these symbols: | | | + | | ( | 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. Page 1/6
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CET 230 Applied Data Structures Fall 2001 MidTerm Exam 2 Name: 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 + -
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

F01MT2 - CET 230 Applied Data Structures Fall 2001 MidTerm...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online