SlideShare a Scribd company logo
6
Most read
7
Most read
9
Most read
Conversion of Infix to Prefix and
Postfix with Stack
Infix Notation
To add A, B, we write
A+B
To multiply A, B, we write
A*B
The operators ('+' ,'*‘ and many more)
go in between the operands ('A' and 'B')
This is "Infix" notation.
Prefix Notation
Instead of saying "A plus B", we could
say "add A,B " and write
+ A B
"Multiply A,B" would be written
* A B
The operators ('+' ,'*‘ and many more) go
in front of the operands ('A' and 'B')
This is “Prefix” notation.
Postfix Notation
Another alternative is to put the
operators after the operands as in
“AB +” and “AB *”
The operators ('+' ,’*‘ and many more) go
in end of the operands ('A' and 'B')
This is “Postfix“ notation.
Priority/Precedence of Arithmetic
Operators:-
Highest Precedence  ( ) , î or ^.
Mid Precedence  * , / .
Lowest Precedence  + , - .
Conversion of Infix to Postfix with stack
 A+B*C
Symbol Stack Postfix
A Empty A
+ + A
B + AB
* +* AB
C +* ABC
+ ABC*
Empty ABC*+
 (A+B)*C
Symbol Stack Postfix
( ( Empty
A ( A
+ (+ A
B (+ AB
) Empty AB+
* * AB+
C * AB+C
AB+C*
Conversion of Infix to Prefix with stack
 (A*B+C)=(C+B*A)
Symbol Stack Postfix
( ( Empty
C ( C
+ (+ C
B (+ CB
* (+* CB
A (+* CBA
) (+*) CBA*+
Prefix=+*ABC
 (A/B^C+D) = (D+C^B/A)
Symbol Stack Postfix
( ( Empty
D ( D
+ (+ D
C (+ DC
^ (+^ DC
B (+^ DCB
/ (+/ DCB^
A (+/ DCB^A
) (+/) DCB^A/+
Prefix:- +/A^BCD
Conversion of Infix to Prefix and Postfix with Stack
Conversion of Infix to Prefix and Postfix with Stack

More Related Content

What's hot (20)

PDF
Stack
Zaid Shabbir
 
PPTX
sorting and its types
SIVASHANKARIRAJAN
 
PDF
Applications of stack
eShikshak
 
PPTX
single linked list
Sathasivam Rangasamy
 
PDF
Array data structure
maamir farooq
 
PPT
Heaps
Hafiz Atif Amin
 
PPT
Expression evaluation
JeeSa Sultana
 
PPTX
Queue ppt
SouravKumar328
 
PPTX
Doubly Linked List
Ninad Mankar
 
PPTX
Binary Heap Tree, Data Structure
Anand Ingle
 
PPTX
Data structure by Digvijay
Digvijay Singh Karakoti
 
PPTX
Arrays in Data Structure and Algorithm
KristinaBorooah
 
PPTX
Linked List - Insertion & Deletion
Afaq Mansoor Khan
 
PPTX
Stacks IN DATA STRUCTURES
Sowmya Jyothi
 
PPT
SEARCHING AND SORTING ALGORITHMS
Gokul Hari
 
PPTX
Unit 4-booth algorithm
vishal choudhary
 
PPT
Parsing
khush_boo31
 
PPT
Infix to Postfix Conversion Using Stack
Soumen Santra
 
PPTX
Merge sort and quick sort
Shakila Mahjabin
 
PPTX
Command line arguments
Ashok Raj
 
sorting and its types
SIVASHANKARIRAJAN
 
Applications of stack
eShikshak
 
single linked list
Sathasivam Rangasamy
 
Array data structure
maamir farooq
 
Expression evaluation
JeeSa Sultana
 
Queue ppt
SouravKumar328
 
Doubly Linked List
Ninad Mankar
 
Binary Heap Tree, Data Structure
Anand Ingle
 
Data structure by Digvijay
Digvijay Singh Karakoti
 
Arrays in Data Structure and Algorithm
KristinaBorooah
 
Linked List - Insertion & Deletion
Afaq Mansoor Khan
 
Stacks IN DATA STRUCTURES
Sowmya Jyothi
 
SEARCHING AND SORTING ALGORITHMS
Gokul Hari
 
Unit 4-booth algorithm
vishal choudhary
 
Parsing
khush_boo31
 
Infix to Postfix Conversion Using Stack
Soumen Santra
 
Merge sort and quick sort
Shakila Mahjabin
 
Command line arguments
Ashok Raj
 

Similar to Conversion of Infix to Prefix and Postfix with Stack (20)

PPTX
infix,postfix,prefixavabanwnwnwjjjj.pptx
zainshahid3040
 
PPTX
Stack application in infix to prefix expression
deepalishinkar1
 
PPTX
data structure stack appplication in python
deepalishinkar1
 
PPT
Lecture6
Muhammad Zubair
 
PPTX
Prefix and PostFIx presentation for DSA .pptx
rtiwary190801
 
PDF
Applications of Stack (Data Structure).pdf
parwarsmko98
 
DOCX
Problem solving with algorithm and data structure
Rabia Tariq
 
PPTX
Data structures (Infix, Prefix and Postfix notations).pptx
itzsomeone50
 
PPTX
Polish Notation In Data Structure
Meghaj Mallick
 
PPTX
Unit 2 application of stack
LavanyaJ28
 
PPTX
DS1.pptx
Momin24
 
PPTX
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
PDF
Infix to Postfix Conversion.pdf
ayushi296420
 
PPT
Application of Stacks
Ain-ul-Moiz Khawaja
 
PPTX
STACK APPLICATIONS: INFOX TO POSTFIX CONVERSION AND EVALUATION OF POSTFIX EXP...
devismileyrockz
 
PPTX
Arithmetic expression INFIX TO POSTFIX CONVERTION saraswathi ramalingam
SaraswathiRamalingam
 
PPTX
week9-prefixinfixandpostfixnotations-191013065821.pptx
ssusere3b1a2
 
PPTX
Prefix, Infix and Post-fix Notations
Afaq Mansoor Khan
 
PPTX
Lecture_04.2.pptx
RockyIslam5
 
PPTX
Convert Infix to Postfix Notation
Jobayer Ahmmed
 
infix,postfix,prefixavabanwnwnwjjjj.pptx
zainshahid3040
 
Stack application in infix to prefix expression
deepalishinkar1
 
data structure stack appplication in python
deepalishinkar1
 
Lecture6
Muhammad Zubair
 
Prefix and PostFIx presentation for DSA .pptx
rtiwary190801
 
Applications of Stack (Data Structure).pdf
parwarsmko98
 
Problem solving with algorithm and data structure
Rabia Tariq
 
Data structures (Infix, Prefix and Postfix notations).pptx
itzsomeone50
 
Polish Notation In Data Structure
Meghaj Mallick
 
Unit 2 application of stack
LavanyaJ28
 
DS1.pptx
Momin24
 
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
Infix to Postfix Conversion.pdf
ayushi296420
 
Application of Stacks
Ain-ul-Moiz Khawaja
 
STACK APPLICATIONS: INFOX TO POSTFIX CONVERSION AND EVALUATION OF POSTFIX EXP...
devismileyrockz
 
Arithmetic expression INFIX TO POSTFIX CONVERTION saraswathi ramalingam
SaraswathiRamalingam
 
week9-prefixinfixandpostfixnotations-191013065821.pptx
ssusere3b1a2
 
Prefix, Infix and Post-fix Notations
Afaq Mansoor Khan
 
Lecture_04.2.pptx
RockyIslam5
 
Convert Infix to Postfix Notation
Jobayer Ahmmed
 
Ad

Recently uploaded (20)

PDF
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPTX
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
PPTX
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
Ad

Conversion of Infix to Prefix and Postfix with Stack

  • 1. Conversion of Infix to Prefix and Postfix with Stack
  • 2. Infix Notation To add A, B, we write A+B To multiply A, B, we write A*B The operators ('+' ,'*‘ and many more) go in between the operands ('A' and 'B') This is "Infix" notation.
  • 3. Prefix Notation Instead of saying "A plus B", we could say "add A,B " and write + A B "Multiply A,B" would be written * A B The operators ('+' ,'*‘ and many more) go in front of the operands ('A' and 'B') This is “Prefix” notation.
  • 4. Postfix Notation Another alternative is to put the operators after the operands as in “AB +” and “AB *” The operators ('+' ,’*‘ and many more) go in end of the operands ('A' and 'B') This is “Postfix“ notation.
  • 5. Priority/Precedence of Arithmetic Operators:- Highest Precedence  ( ) , î or ^. Mid Precedence  * , / . Lowest Precedence  + , - .
  • 6. Conversion of Infix to Postfix with stack  A+B*C Symbol Stack Postfix A Empty A + + A B + AB * +* AB C +* ABC + ABC* Empty ABC*+
  • 7.  (A+B)*C Symbol Stack Postfix ( ( Empty A ( A + (+ A B (+ AB ) Empty AB+ * * AB+ C * AB+C AB+C*
  • 8. Conversion of Infix to Prefix with stack  (A*B+C)=(C+B*A) Symbol Stack Postfix ( ( Empty C ( C + (+ C B (+ CB * (+* CB A (+* CBA ) (+*) CBA*+ Prefix=+*ABC
  • 9.  (A/B^C+D) = (D+C^B/A) Symbol Stack Postfix ( ( Empty D ( D + (+ D C (+ DC ^ (+^ DC B (+^ DCB / (+/ DCB^ A (+/ DCB^A ) (+/) DCB^A/+ Prefix:- +/A^BCD