PadhaikoAll subjects

Past exam question: 2062 Baishakh (Regular / Back), Q2(b)

Data Structure and Algorithms · 4 marks

Open in the Padhaiko app

Topic: Definition of stack and its operations · Array implementation of…

Question

Convert the following infix expression into prefix and postfix expression. i) a \$ b * c - d + e / f / (g + h) ii) ((a + b) * c - (d - e)) \$ (f + g)

Solution

Part i) a \$ b * c - d + e / f / (g + h): Operator precedence: \$ *, / (left-associative) +, - (left-associative).

Part ii) ((a + b) * c - (d - e)) \$ (f + g):

Answer:

All past exam questions for Data Structure and Algorithms