Professional Documents
Culture Documents
Data Structures: Assignment 1
Data Structures: Assignment 1
ASSIGNMENT 1
Q.) USING CONCEPTS OF STACKS. DESCRIBE
PSEUDOCODE TO CONVERT POSTFIX TO INFIX
EXPRESSION.ALSO USE AN EXAMPLE TO EXPLAIN THE
SAME
Answer:
If (character is an operand)
Push(S, character)
Else
Operand2=pop(s)
Operand1=pop(s)
Let x be temporary variable such that operand1 & operand2 are stored in it.
IF = x
x=0
}
EXAMPLE:-
Let us take a postfix expression. Say for e.g. AB*CD*/. As soon as we get an
operand we have to push that element in to the stack. We get an operator we have
to pop the element which was in the stack.