Infix to Postfix Conversion using Stack | DSA using Java #21

Veröffentlicht am: 11 September 2021
auf dem Kanal: ForMyScholars
24,733
459

Infix to Postfix using Stack | DSA using Java 2021 l Stack Series

Infix to Postfix Conversion
Any expression can be represented using three types of expressions (Infix, Postfix, and Prefix). We can also convert one type of expression to another type of expression like Infix to Postfix, Infix Postfix to Prefix and vice versa.

To convert any Infix expression into Postfix or Prefix expression we can use the following procedure...

Find all the operators in the given Infix Expression.
Find the order of operators evaluated according to their Operator precedence.
Convert each operator into required type of expression (Postfix or Prefix) in the same order.
Example
Consider the following Infix Expression to be converted into Postfix Expression...

D = A + B * C
Step 1 - The Operators in the given Infix Expression : = , + , *
Step 2 - The Order of Operators according to their preference : * , + , =
Step 3 - Now, convert the first operator * ----- D = A + B C *
Step 4 - Convert the next operator + ----- D = A BC* +
Step 5 - Convert the next operator = ----- D ABC*+ =
Finally, given Infix Expression is converted into Postfix Expression as follows...

D A B C * + =

Infix to Postfix Conversion using Stack Data Structure
To convert Infix Expression into Postfix Expression using a stack data structure, We can use the following steps...

Read all the symbols one by one from left to right in the given Infix Expression.
If the reading symbol is an operand, then directly print it to the result (Output).
If the reading symbol is left parenthesis '(', then Push it onto the Stack.
If the reading symbol is right parenthesis ')', then Pop all the contents of stack until respective left parenthesis is poped and print each poped symbol to the result.
If the reading symbol is operator (+ , - , * , / etc.,), then Push it on to the Stack. However, first, pop the operators which are already on the stack that have higher or equal precedence than current operator and print them to the result.

Topic Covered:
data structure tutorials
data structure and algorithms
infix to postfix using stack
infix to postfix conversion
how to convert infix to postfix
infix to postfix in data structure
infix postfix and prefix
ugc net computer science preparation
GATE cs coaching classes
cs it youtube channels
c programming tutorials
data structure notes
prefix evaluation using stack
evaluation of postfix expression using stack

Use my code deepali10 to get 10% discount
Career as a Developer: https://unacademy.com/goal/career-as-...
Reach for the Stars: https://bit.ly/Unacademy-Deepali-Soft...

Link to Data structure using Java Playlist:
   • Data Structure using Java  

Join the Telegram Group for interview preparation material and updates:
https://t.me/formyscholarsdeepali

You can also reach me at:
Instagram:   / formyscholarsdeepali  
LinkedIn:   / formyscholarsdeepali  

#formyscholars #DSA #datastructure

For Online/Offline Training & Business Enquiry:
Email-id: formyscholars4u@gmail.com

Disclaimer: The information given in this video is as per my research and knowledge. Kindly do your research also before taking any step to go further.


Auf dieser Seite können Sie das Online-Video Infix to Postfix Conversion using Stack | DSA using Java #21 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer ForMyScholars 11 September 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 24,733 Mal angesehen und es wurde von 459 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!