SlideShare una empresa de Scribd logo
1 de 23
Infix to Postfix conversion
Infix notation ,[object Object]
E.g. A + B,[object Object]
For example, the Infix expression A+B will be written as AB+ in its Postfix Notation.
Postfix is also called ‘Reverse Polish Notation’ ,[object Object]
The Infix expression A+B will be written as +AB in its Prefix Notation.
Prefix is also called ‘Polish Notation’ ,[object Object],[object Object],[object Object]
Pop all the operators which are of higher or equal precedence then the incoming token and append them (in the same order) to the output Expression.
After popping out all such operators, push the new token on stack.,[object Object]
Pop all the operators from the Stack and append them to Output String, till you encounter the Opening Parenthesis “(“.
Pop the left parenthesis but don’t append it to the output string (Postfix notation does not have brackets).,[object Object]
The Output string is the Corresponding Postfix Notation.,[object Object]
Example Stage 2 ,[object Object],[object Object],[object Object]
But when another operator is to come on the top of ‘(‘ then its precedence is least.,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Infix to postfix conversion
Infix to postfix conversion
Infix to postfix conversion
Infix to postfix conversion
Infix to postfix conversion
Infix to postfix conversion
Infix to postfix conversion
Infix to postfix conversion
Infix to postfix conversion

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Presentation on queue
Presentation on queuePresentation on queue
Presentation on queue
 
stack presentation
stack presentationstack presentation
stack presentation
 
Linked List
Linked ListLinked List
Linked List
 
Queue - Data Structure - Notes
Queue - Data Structure - NotesQueue - Data Structure - Notes
Queue - Data Structure - Notes
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
Infix prefix postfix
Infix prefix postfixInfix prefix postfix
Infix prefix postfix
 
Hashing
HashingHashing
Hashing
 
Queues
QueuesQueues
Queues
 
Infix to Postfix Conversion Using Stack
Infix to Postfix Conversion Using StackInfix to Postfix Conversion Using Stack
Infix to Postfix Conversion Using Stack
 
Linked list
Linked listLinked list
Linked list
 
Conversion of Infix to Prefix and Postfix with Stack
Conversion of Infix to Prefix and Postfix with StackConversion of Infix to Prefix and Postfix with Stack
Conversion of Infix to Prefix and Postfix with Stack
 
stack & queue
stack & queuestack & queue
stack & queue
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
 
Stack a Data Structure
Stack a Data StructureStack a Data Structure
Stack a Data Structure
 
Stack using Array
Stack using ArrayStack using Array
Stack using Array
 
Stack
StackStack
Stack
 
Unit 4 python -list methods
Unit 4   python -list methodsUnit 4   python -list methods
Unit 4 python -list methods
 
Priority queue in DSA
Priority queue in DSAPriority queue in DSA
Priority queue in DSA
 
Stack
StackStack
Stack
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
 

Destacado

358 33 powerpoint-slides_9-stacks-queues_chapter-9
358 33 powerpoint-slides_9-stacks-queues_chapter-9358 33 powerpoint-slides_9-stacks-queues_chapter-9
358 33 powerpoint-slides_9-stacks-queues_chapter-9sumitbardhan
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTUREArchie Jamwal
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURESbca2010
 
Infix-Postfix expression conversion
Infix-Postfix expression conversionInfix-Postfix expression conversion
Infix-Postfix expression conversionRashmiranja625
 
Conversion from infix to prefix using stack
Conversion from infix to prefix using stackConversion from infix to prefix using stack
Conversion from infix to prefix using stackHaqnawaz Ch
 
Infix prefix postfix expression -conversion
Infix  prefix postfix expression -conversionInfix  prefix postfix expression -conversion
Infix prefix postfix expression -conversionSyed Mustafa
 
My lecture infix-to-postfix
My lecture infix-to-postfixMy lecture infix-to-postfix
My lecture infix-to-postfixSenthil Kumar
 
Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)Ahmed Khateeb
 
Expression evaluation
Expression evaluationExpression evaluation
Expression evaluationJeeSa Sultana
 
Infix to-postfix examples
Infix to-postfix examplesInfix to-postfix examples
Infix to-postfix examplesmua99
 

Destacado (12)

358 33 powerpoint-slides_9-stacks-queues_chapter-9
358 33 powerpoint-slides_9-stacks-queues_chapter-9358 33 powerpoint-slides_9-stacks-queues_chapter-9
358 33 powerpoint-slides_9-stacks-queues_chapter-9
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 
Infix-Postfix expression conversion
Infix-Postfix expression conversionInfix-Postfix expression conversion
Infix-Postfix expression conversion
 
Conversion from infix to prefix using stack
Conversion from infix to prefix using stackConversion from infix to prefix using stack
Conversion from infix to prefix using stack
 
Infix prefix postfix expression -conversion
Infix  prefix postfix expression -conversionInfix  prefix postfix expression -conversion
Infix prefix postfix expression -conversion
 
Infix to postfix
Infix to postfixInfix to postfix
Infix to postfix
 
My lecture infix-to-postfix
My lecture infix-to-postfixMy lecture infix-to-postfix
My lecture infix-to-postfix
 
Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)
 
Expression evaluation
Expression evaluationExpression evaluation
Expression evaluation
 
Conversion of Infix To Postfix Expressions
Conversion of Infix To Postfix Expressions Conversion of Infix To Postfix Expressions
Conversion of Infix To Postfix Expressions
 
Infix to-postfix examples
Infix to-postfix examplesInfix to-postfix examples
Infix to-postfix examples
 

Similar a Infix to postfix conversion

Infix postfixcoversion
Infix postfixcoversionInfix postfixcoversion
Infix postfixcoversionPdr Patnaik
 
Infix to Postfix Conversion.pdf
Infix to Postfix Conversion.pdfInfix to Postfix Conversion.pdf
Infix to Postfix Conversion.pdfayushi296420
 
stack-111104232459-phpapp02.pdf
stack-111104232459-phpapp02.pdfstack-111104232459-phpapp02.pdf
stack-111104232459-phpapp02.pdfKalpana Mohan
 
Application of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptx
Application of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptxApplication of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptx
Application of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptxPrakash Zodge
 
Lecture_04.2.pptx
Lecture_04.2.pptxLecture_04.2.pptx
Lecture_04.2.pptxRockyIslam5
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manualnikshaikh786
 
COMP1603 Stacks and RPN 2023 Recording (2).pptx
COMP1603 Stacks and RPN 2023 Recording (2).pptxCOMP1603 Stacks and RPN 2023 Recording (2).pptx
COMP1603 Stacks and RPN 2023 Recording (2).pptxasdadad5
 
Infix to postfix expression in ds
Infix to postfix expression in dsInfix to postfix expression in ds
Infix to postfix expression in dsRohini Mahajan
 
Lec5-Stack-bukc-28022024-112316am (1) .pptx
Lec5-Stack-bukc-28022024-112316am (1) .pptxLec5-Stack-bukc-28022024-112316am (1) .pptx
Lec5-Stack-bukc-28022024-112316am (1) .pptxhaaamin01
 
Concept of stack ,stack of aaray stack by linked list , application of stac...
Concept of stack ,stack of aaray   stack by linked list , application of stac...Concept of stack ,stack of aaray   stack by linked list , application of stac...
Concept of stack ,stack of aaray stack by linked list , application of stac...muskankumari7360
 
Please need help on C++ language.Infix to Postfix) Write a program.pdf
Please need help on C++ language.Infix to Postfix) Write a program.pdfPlease need help on C++ language.Infix to Postfix) Write a program.pdf
Please need help on C++ language.Infix to Postfix) Write a program.pdfpristiegee
 
Stack in Data Structure
Stack in Data StructureStack in Data Structure
Stack in Data StructureUshaP15
 
Unit 2 application of stack
Unit 2  application of stack Unit 2  application of stack
Unit 2 application of stack LavanyaJ28
 
2. Stack. Write a program that uses the stack class (you can use.pdf
2. Stack. Write a program that uses the stack class (you can use.pdf2. Stack. Write a program that uses the stack class (you can use.pdf
2. Stack. Write a program that uses the stack class (you can use.pdfaniarihant
 

Similar a Infix to postfix conversion (20)

Infix postfixcoversion
Infix postfixcoversionInfix postfixcoversion
Infix postfixcoversion
 
Infix to Postfix Conversion.pdf
Infix to Postfix Conversion.pdfInfix to Postfix Conversion.pdf
Infix to Postfix Conversion.pdf
 
MO 2020 DS Stacks 3 AB.ppt
MO 2020 DS Stacks 3 AB.pptMO 2020 DS Stacks 3 AB.ppt
MO 2020 DS Stacks 3 AB.ppt
 
DS UNIT1_STACKS.pptx
DS UNIT1_STACKS.pptxDS UNIT1_STACKS.pptx
DS UNIT1_STACKS.pptx
 
stack-111104232459-phpapp02.pdf
stack-111104232459-phpapp02.pdfstack-111104232459-phpapp02.pdf
stack-111104232459-phpapp02.pdf
 
Application of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptx
Application of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptxApplication of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptx
Application of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptx
 
stack-Intro.pptx
stack-Intro.pptxstack-Intro.pptx
stack-Intro.pptx
 
Lecture_04.2.pptx
Lecture_04.2.pptxLecture_04.2.pptx
Lecture_04.2.pptx
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manual
 
COMP1603 Stacks and RPN 2023 Recording (2).pptx
COMP1603 Stacks and RPN 2023 Recording (2).pptxCOMP1603 Stacks and RPN 2023 Recording (2).pptx
COMP1603 Stacks and RPN 2023 Recording (2).pptx
 
CH4.pptx
CH4.pptxCH4.pptx
CH4.pptx
 
Infix to postfix expression in ds
Infix to postfix expression in dsInfix to postfix expression in ds
Infix to postfix expression in ds
 
Lec5-Stack-bukc-28022024-112316am (1) .pptx
Lec5-Stack-bukc-28022024-112316am (1) .pptxLec5-Stack-bukc-28022024-112316am (1) .pptx
Lec5-Stack-bukc-28022024-112316am (1) .pptx
 
Concept of stack ,stack of aaray stack by linked list , application of stac...
Concept of stack ,stack of aaray   stack by linked list , application of stac...Concept of stack ,stack of aaray   stack by linked list , application of stac...
Concept of stack ,stack of aaray stack by linked list , application of stac...
 
Unit 3 stack
Unit   3 stackUnit   3 stack
Unit 3 stack
 
Please need help on C++ language.Infix to Postfix) Write a program.pdf
Please need help on C++ language.Infix to Postfix) Write a program.pdfPlease need help on C++ language.Infix to Postfix) Write a program.pdf
Please need help on C++ language.Infix to Postfix) Write a program.pdf
 
Stack in Data Structure
Stack in Data StructureStack in Data Structure
Stack in Data Structure
 
Unit 2 application of stack
Unit 2  application of stack Unit 2  application of stack
Unit 2 application of stack
 
2. Stack. Write a program that uses the stack class (you can use.pdf
2. Stack. Write a program that uses the stack class (you can use.pdf2. Stack. Write a program that uses the stack class (you can use.pdf
2. Stack. Write a program that uses the stack class (you can use.pdf
 
Stack Operation In Data Structure
Stack Operation In Data Structure Stack Operation In Data Structure
Stack Operation In Data Structure
 

Más de Then Murugeshwari (20)

Traffic safety
Traffic safetyTraffic safety
Traffic safety
 
P h indicators
P h indicatorsP h indicators
P h indicators
 
Avogadro's law
Avogadro's lawAvogadro's law
Avogadro's law
 
Resonance
ResonanceResonance
Resonance
 
Microwave remote sensing
Microwave remote sensingMicrowave remote sensing
Microwave remote sensing
 
Newton's law
Newton's lawNewton's law
Newton's law
 
Surface tension
Surface tensionSurface tension
Surface tension
 
Hook's law
Hook's lawHook's law
Hook's law
 
Hook's law
Hook's lawHook's law
Hook's law
 
ERP components
ERP componentsERP components
ERP components
 
Database fundamentals
Database fundamentalsDatabase fundamentals
Database fundamentals
 
Mosfet
MosfetMosfet
Mosfet
 
Operators
OperatorsOperators
Operators
 
Hiperlan
HiperlanHiperlan
Hiperlan
 
Bluetooth profile
Bluetooth profileBluetooth profile
Bluetooth profile
 
Router
RouterRouter
Router
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Thread priorities
Thread prioritiesThread priorities
Thread priorities
 
Threads
ThreadsThreads
Threads
 
Identifiers
Identifiers Identifiers
Identifiers
 

Infix to postfix conversion

  • 1. Infix to Postfix conversion
  • 2.
  • 3.
  • 4. For example, the Infix expression A+B will be written as AB+ in its Postfix Notation.
  • 5.
  • 6. The Infix expression A+B will be written as +AB in its Prefix Notation.
  • 7.
  • 8. Pop all the operators which are of higher or equal precedence then the incoming token and append them (in the same order) to the output Expression.
  • 9.
  • 10. Pop all the operators from the Stack and append them to Output String, till you encounter the Opening Parenthesis “(“.
  • 11.
  • 12.
  • 13.
  • 14.