Problem 1
Describe the two basic operations on a stack.
Problem 4
Consider the following statements:
stackType
Problem 5
Evaluate the following postfix expressions: a. 8 2 + 3 * 16 4 / - = b. 12 25 5 1 / / * 8 7 + - = c. 70 14 4 5 15 3 / * - - / 6 + = d. 3 5 6 * + 13 - 18 2 / + =
Problem 6
Convert the following infix expressions to postfix notations. a. (A + B) * (C + D) - E b. A - (B + C) * D + E / F c. ((A + B) / (C - D) + E) * F - G d. A + B * (C + D) - E / F * G + H
Problem 7
Write the equivalent infix expression for the following postfix expressions. a. A B * C + b. A B + C D - * c. A B – C – D *
Problem 11
Suppose that stack is an object of type 1 inkedstackType \(\langle\text { int }\rangle .\) What is the difference between the statements stack.top () ; and stack.pop();?
Problem 13
Write the definition of the method second that takes as a parameter a stack object and returns the second element of the stack. The original stack remains unchanged.
Problem 14
Consider the following statements:
queueType
Problem 16
What does the following function do?
void mystery(queueType
Problem 17
Suppose that queue is a queueType object and the size of the array implementing queue is \(100 .\) Also, suppose that the value of queueFront is 50 and the value of queueRear is 99 a. What are the values of queueFront and queueRear after adding an element to queue? b. What are the values of queueFront and queueRear after removing an element from queue?