Data Structures : Stacks and Queues using Lists Sumita arora Type B solution



Q1. Translate following infix expression into its equivalent postfix expression:

((A - B) * (D/E))/ (F*G* H)




Q2. Translate following infix expression into its equivalent postfix expression:

(A + B| D)/ (E- F) + G




Q3. Translate following infix expression into its equivalent postfix expression:

A (B + D)/ E - F - (G+ H/K)




Q4. Write the equivalent infix expression for

10, 3, *, 7, 1, -, *, 23, +




Q5. Write the equivalent infix expression for a, b, AND, a, c, AND, OR.



Q6. Consider the arithmetic expression P, written in postfix notation:

12, 7, 3, -, /, 2, 1, 5, +, *, +

(a) Translate P, into its equivalent infix expression.
(b) Evaluate the infix expression.




Q7. Convert the following infix notation of expression to an equivalent postfix notation of expression (Show status of Stack after execution of each operation): (A + B) * C - D / E




Q8. Consider each of the following postfix expressions:

P1 : 5, 3, +, 2, *, 6, 9, 7, -, /, -
P2 : 3, 5, +, 6, 4, -, *, 4, 1, -, 2, |, +
P3 : 3, 1, +, 2, |, 7, 4, - 2, *, +, 5, -

Translate each expression into infix notation and then evaluate.



Q9. Give postfix form of the following expression: A*(B+(C+ D)*(E+ F)/G)* H



Q10. Give postfix form for A+ [(B+C) + (D+ E) * F] / G



Q11. Give postfix form of expression for the following:

(i) NOT A OR NOT B AND NOT C
(ii) NOT (A OR B) AND C




Q12. Evaluate the following postfix notation of expression:

True, False, NOT, AND, True, True, AND, OR




Q13. Evaluate the following postfix expression using a stack and show the contents of the stack after execution of each operation 5, 11, -, 6, 8, +, 12, *, /




Q14. Let P be the postfix arithmetic expression: 7, 2,-, 1, 14, 1, 2, * Evaluate P using stack and showing the status of the stack at every step.




Q15. Consider the infix expression: Q: A + B * C | T (D / E) / F.

Translate Q into P, where P is the postfix equivalent expression of Q. What will be the result of Q if this expression is evaluated for A, B, C, D, E, F as 2, 3, 2, 7, 2, 2 respectively




Q16. Write equivalent Postfix expressions for the infix expressions given below:

(i) A + B - D/X
(ii) (X+Y) / (Z*Y) - R




Q17. Evaluate the following postfix notation of expression: 10 20 + 25 15 -* 30 /



Q18. Evaluate the following postfix notation of expression: 20 10 + 5 2 *- 10 /



Q19. Evaluate the following postfix expression using a stack and show the contents of stack after execution of each operation: 120, 45, 20, +, 25, 15, -, +, *



Q20. Evaluate the following postfix expression using a stack and show the contents of stack after execution of each operation:

20, 45, +, 20, 10, 15, +, *




Q21. Use a stack to evaluate the following postfix expression and show the content of the stack after execution of each operation. Don't write any code. Assume as if you are using push and pop member functions of the stack AB - CD + E * + (where A = 5, B = 3, C = 5, D = 4, and E = 2)



Q22. Change the following infix expression into postfix expression. (A + B) * C+D / E - F



Q23. Evaluate the following postfix notation of expression:

(Show status of Stack after each operation)
True, False, NOT, OR, False, True, OR, AND




Q24. Convert the following infix expression to its equivalent postfix expression showing stack contents for the conversion: X - Y / (Z + U) * V



Q25. Convert the following infix expression to its equivalent postfix expression showing stack contents for the conversion: A + B * (C - D) /E

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post