Conversion of Infix to Postfix Expression using Stack

To convert Infix expression to Postfix expression, we will use the stack data structure. By scanning the infix expression from left to right,if we get any operand, simply add it to the postfix form, and for the operator and parenthesis, add them in the stack maintaining the precedence of them.

Read this article to understand Conversion of Infix to Postfix Expression using Stack in depth

Have a doubt or thought? Join the discussion now


This is a companion discussion topic for the original entry at http://iq.opengenus.org/infix-to-postfix-expression-stack/
1 Like

The time complexity given is wrong. Since stack operation in O(1) and each element is scanned once and pushed/popped from stack once, the time complexity is O(2N) ~ O(N). Please fix this!!!