Data Structures using C Part 4 - Stack Algorithm for infix to postfix | Convert infix to postfix

Published: 26 May 2017
on channel: Ankpro Training
16,281
151

Algorithm : infix to postfix

Start
Scan Q from left to right and repeat steps 3 to 6 for each character of Q until the Stack is empty.
If c == operand, then add it to P.
If c == ‘( ‘ then push it onto Stack.
if c == operator, then
Repeatedly POP operators from stack and add to P whose precedence is same as or the higher than the precedence of scanned operator.
And PUSH the scanned operator to Stack.
if c == ‘ )’ then
Repeatedly POP each operator from the Stack and add to P until a left parenthesis is found.
Remove the left parenthesis from the Stack.
Stop

Convert infix to postfix
Q : ( A + B ) / ( C - D )


P : AB + CD - /
Q : ( ( A – ( B + C ) ) * D ) / ( E + F )


P : A B C + - D * E A + /
( A + B ) / ( C - D )

( ( A – ( B + C ) ) * D ) / ( E + F )

C program to convert an INFIX exp. to POSTFIX form


ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
C
C++
Components of the .Net framework
Hello World
Literal
Keywords
Variable
Data types
Operators
Branching
Loops
Arrays
Strings
Structures
Enums
Functions


On this page of the site you can watch the video online Data Structures using C Part 4 - Stack Algorithm for infix to postfix | Convert infix to postfix with a duration of hours minute second in good quality, which was uploaded by the user Ankpro Training 26 May 2017, share the link with friends and acquaintances, this video has already been watched 16,281 times on youtube and it was liked by 151 viewers. Enjoy your viewing!