PadhaikoAll subjects

Past exam question: 2065 Shrawan (Regular / Back), Q2

Data Structure and Algorithms · 8 marks

Open in the Padhaiko app

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

Question

Define stack as an ADT? Convert the following infix expression onto prefix and post fix. a) A + [B + C + (D + E) * F] / G b) ((a + b) * c - (d - e) \$ (f + g)

Solution

Stack as an ADT:

Part a) A + [B + C + (D + E) * F] / G: Treat [ and ] as grouping brackets identical to ( and ):

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

Answer:

All past exam questions for Data Structure and Algorithms