Professional Documents
Culture Documents
DSA Quiz 2
DSA Quiz 2
// Program A
Stack aStack;
aStack.push(‘a’);
aStack.push(‘b’);
aStack.pop();
aStack.push(‘c’);
aStack.pop();
aStack.push(‘d’);
a. If a program is executed on stack implementation array, draw the situation of stack after each
implementation in figure below.
Top
[4]
[3]
[2]
[1]
[0]
data data data data data data data
b. If the program is executed on stack implementation link list, draw the situation of stack after
each implementation in figure.
Top NULL
STEP 1 Top
STEP 2 Top
STEP 3 Top
STEP 4 Top
STEP 5 Top
STEP 6 Top
c. Convert the following infix expressions to prefix and postfix form by using the knowledge you
learn in this chapter.
I. a/b/c-(d+e)*f II. a-(b/c*d)