-
Notifications
You must be signed in to change notification settings - Fork 214
Added Infix to Postfix Conversion in Python #235
Added Infix to Postfix Conversion in Python #235
Conversation
@@ -0,0 +1,12 @@ | |||
#In Infix expression operator is in between every pair of operands. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the README to this ⬇
### Infix to Postfix
> • In Infix expression operator is in between every pair of operands.<br>
> • In Postfix expression, the operator is followed for every pair of operands.
- Infix expression is converted to postfix conversion using Stack.
- Postfix expression is evaluated using Stack in Left to Right order.
##### If the scanned character is operand, show it as output. Else, If precedence of scanned operator is greater than the precedence of the operator in the stack,push it.
> Else, Pop all the operators from the stack which are greater than or equal to in precedence than that of the scanned operator.
• If the scanned input is '(', push it into stack<br>
• If the scanned input is ')' ,pop the stack and the output it until '(' comes.<br>
• Repeat above steps. Continue Pop and output from stack until it becomes empty.
##### It makes the code more efficient and even reduces the time complexity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just replace the above text with the present one.
# Displaying the Output | ||
print("Postfix expression: ", infix_to_postfix(infix_expression)) | ||
|
||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this part in README under Constraints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated changes. Kindly review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work @nutanaarohi123 ! 🎉
- Nice & Clean code 😄
Nice @nutanaarohi123 |
Infix expression is converted to postfix conversion using Stack and evaluated in Left to Right order.
It makes the code more efficient and even reduces the time complexity.
Have Read the contributing guidelines ?
YES
Issue No.
#91 (Issue no. 1 )