Prefix to Postfix conversion

 Steps to convert prefix expression to postfix

  1. Scan the given prefix expression from right to left character by character.

  2. If the character is an operand, push it into the stack.

  3. But if the character is an operator, pop the top two values from stack.

    Concatenate this operator with these two values (1st top value+2nd top value+operator) to get a new string.

  4. Now push this resulting string back into the stack.

 

 Conversion of Prefix to Postfix using Stack

* - A / B C - / A K L 

 


 

No comments:

Post a Comment