SlideShare a Scribd company logo
1 of 7
TOPIC : INFIX , POSTFIX , PREFIX EXPRESSIONS
PRESENTED BY :
CONTENTS.
 What are INFIX , POSTFIX , PREFIX EXPRESIONS
 Some rules for conversion
 Some Examples
 INFIX : an infix expression is one in which operators are located between their
operands.
Eg. (A + (B * C)) + D)
 POSTFIX : an postfix expression is one in which operators are located after its
operands, according to their precedence.
Eg. A B C * + D +
 PREFIX : an prefix expression is one in which operators are located before its operands,
according to their precedence.
Eg. + + A * B C D
What is INFIX , POSTFIX , PREFIX ?
SOME RULES FOR CONVERSION
 Highest priority -> ^
 Next priority -> / , *
 Least priority -> + , -
 No two operators of same priority can stay together in stack .
 Least priority operator cannot be placed above the highest priority operator
in stack.
INFIX TO POSTFIX
 Eg. (A + B / C * (D + E ) )
Input String Output Operator Stack
(A + B / C * (D + E ) ) (
(A + B / C * (D + E ) ) A (
(A + B / C * (D + E ) ) A (+
(A + B / C * (D + E ) ) A B (+
(A + B / C * (D + E ) ) A B (+/
(A + B / C * (D + E ) ) A B C (+/
(A + B / C * (D + E ) ) A B C / (+*
(A + B / C * (D + E ) ) A B C /
(+*(
(A + B / C * (D + E ) ) A B C / D (+*(+
(A + B / C * (D + E ) ) A B C / D E (+*(+
(A + B / C * (D + E ) ) A B C / D E + (+*
(A + B / C * (D + E ) ) A B C / D E + *+
INFIX TO PREFIX
 Eg . A + B * C – D + E
Input String Operator Stack Output
E E
+ + E
D + ED
- - ED+
C - ED+C
* - * ED+C
( - * ( ED+C
B+ - * ( ED+CB
A - * ( + ED+CBA
) - * ED+CBA+
- ED+CBA+*
ED+CBA+*-
OUTPUT -*+ABC+DE
C code for infix to postfix
 Lets see some examples

More Related Content

Similar to DS1.pptx

Prefix, Infix and Post-fix Notations
Prefix, Infix and Post-fix NotationsPrefix, Infix and Post-fix Notations
Prefix, Infix and Post-fix NotationsAfaq Mansoor Khan
 
Infix to-postfix examples
Infix to-postfix examplesInfix to-postfix examples
Infix to-postfix examplesmua99
 
Stack Data Structure V1.0
Stack Data Structure V1.0Stack Data Structure V1.0
Stack Data Structure V1.0Zidny Nafan
 
1.3- infix-ti-postfix.pdf
1.3- infix-ti-postfix.pdf1.3- infix-ti-postfix.pdf
1.3- infix-ti-postfix.pdfsoniasharmafdp
 
Stack - Data Structure - Notes
Stack - Data Structure - NotesStack - Data Structure - Notes
Stack - Data Structure - NotesOmprakash Chauhan
 
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_Application_Infix_Prefix.pptx
Stack_Application_Infix_Prefix.pptxStack_Application_Infix_Prefix.pptx
Stack_Application_Infix_Prefix.pptxsandeep54552
 
Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)mailmerk
 
Conversion of in fix pre fix,infix by sarmad baloch
Conversion of in fix pre fix,infix by sarmad balochConversion of in fix pre fix,infix by sarmad baloch
Conversion of in fix pre fix,infix by sarmad balochSarmad Baloch
 

Similar to DS1.pptx (20)

Team 4
Team 4Team 4
Team 4
 
Prefix, Infix and Post-fix Notations
Prefix, Infix and Post-fix NotationsPrefix, Infix and Post-fix Notations
Prefix, Infix and Post-fix Notations
 
Stacks.ppt
Stacks.pptStacks.ppt
Stacks.ppt
 
Stacks.ppt
Stacks.pptStacks.ppt
Stacks.ppt
 
Lecture6
Lecture6Lecture6
Lecture6
 
Infix to-postfix examples
Infix to-postfix examplesInfix to-postfix examples
Infix to-postfix examples
 
Stack Data Structure V1.0
Stack Data Structure V1.0Stack Data Structure V1.0
Stack Data Structure V1.0
 
Stack
StackStack
Stack
 
stack
stackstack
stack
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
 
1.3- infix-ti-postfix.pdf
1.3- infix-ti-postfix.pdf1.3- infix-ti-postfix.pdf
1.3- infix-ti-postfix.pdf
 
Stack - Data Structure - Notes
Stack - Data Structure - NotesStack - Data Structure - Notes
Stack - Data Structure - Notes
 
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_Application_Infix_Prefix.pptx
Stack_Application_Infix_Prefix.pptxStack_Application_Infix_Prefix.pptx
Stack_Application_Infix_Prefix.pptx
 
Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)
 
Conversion of in fix pre fix,infix by sarmad baloch
Conversion of in fix pre fix,infix by sarmad balochConversion of in fix pre fix,infix by sarmad baloch
Conversion of in fix pre fix,infix by sarmad baloch
 
Stack
StackStack
Stack
 
Stack
StackStack
Stack
 
Data structures
Data structures Data structures
Data structures
 
C applications
C applicationsC applications
C applications
 

More from Momin24

Uni junction transistor.pptx
Uni junction transistor.pptxUni junction transistor.pptx
Uni junction transistor.pptxMomin24
 
evsPRENTATION.pptx
evsPRENTATION.pptxevsPRENTATION.pptx
evsPRENTATION.pptxMomin24
 
stack data structure
stack data structurestack data structure
stack data structureMomin24
 
ds presentation.pptx
ds presentation.pptxds presentation.pptx
ds presentation.pptxMomin24
 
Correlation(r) coefficients of corelation.pptx
Correlation(r) coefficients of corelation.pptxCorrelation(r) coefficients of corelation.pptx
Correlation(r) coefficients of corelation.pptxMomin24
 
SEMICONDUCTOR MEMORIES(RAM &ROM).pptx
SEMICONDUCTOR MEMORIES(RAM &ROM).pptxSEMICONDUCTOR MEMORIES(RAM &ROM).pptx
SEMICONDUCTOR MEMORIES(RAM &ROM).pptxMomin24
 

More from Momin24 (7)

Uni junction transistor.pptx
Uni junction transistor.pptxUni junction transistor.pptx
Uni junction transistor.pptx
 
evsPRENTATION.pptx
evsPRENTATION.pptxevsPRENTATION.pptx
evsPRENTATION.pptx
 
stack data structure
stack data structurestack data structure
stack data structure
 
ds.pptx
ds.pptxds.pptx
ds.pptx
 
ds presentation.pptx
ds presentation.pptxds presentation.pptx
ds presentation.pptx
 
Correlation(r) coefficients of corelation.pptx
Correlation(r) coefficients of corelation.pptxCorrelation(r) coefficients of corelation.pptx
Correlation(r) coefficients of corelation.pptx
 
SEMICONDUCTOR MEMORIES(RAM &ROM).pptx
SEMICONDUCTOR MEMORIES(RAM &ROM).pptxSEMICONDUCTOR MEMORIES(RAM &ROM).pptx
SEMICONDUCTOR MEMORIES(RAM &ROM).pptx
 

Recently uploaded

Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 

Recently uploaded (20)

Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 

DS1.pptx

  • 1. TOPIC : INFIX , POSTFIX , PREFIX EXPRESSIONS PRESENTED BY :
  • 2. CONTENTS.  What are INFIX , POSTFIX , PREFIX EXPRESIONS  Some rules for conversion  Some Examples
  • 3.  INFIX : an infix expression is one in which operators are located between their operands. Eg. (A + (B * C)) + D)  POSTFIX : an postfix expression is one in which operators are located after its operands, according to their precedence. Eg. A B C * + D +  PREFIX : an prefix expression is one in which operators are located before its operands, according to their precedence. Eg. + + A * B C D What is INFIX , POSTFIX , PREFIX ?
  • 4. SOME RULES FOR CONVERSION  Highest priority -> ^  Next priority -> / , *  Least priority -> + , -  No two operators of same priority can stay together in stack .  Least priority operator cannot be placed above the highest priority operator in stack.
  • 5. INFIX TO POSTFIX  Eg. (A + B / C * (D + E ) ) Input String Output Operator Stack (A + B / C * (D + E ) ) ( (A + B / C * (D + E ) ) A ( (A + B / C * (D + E ) ) A (+ (A + B / C * (D + E ) ) A B (+ (A + B / C * (D + E ) ) A B (+/ (A + B / C * (D + E ) ) A B C (+/ (A + B / C * (D + E ) ) A B C / (+* (A + B / C * (D + E ) ) A B C / (+*( (A + B / C * (D + E ) ) A B C / D (+*(+ (A + B / C * (D + E ) ) A B C / D E (+*(+ (A + B / C * (D + E ) ) A B C / D E + (+* (A + B / C * (D + E ) ) A B C / D E + *+
  • 6. INFIX TO PREFIX  Eg . A + B * C – D + E Input String Operator Stack Output E E + + E D + ED - - ED+ C - ED+C * - * ED+C ( - * ( ED+C B+ - * ( ED+CB A - * ( + ED+CBA ) - * ED+CBA+ - ED+CBA+* ED+CBA+*- OUTPUT -*+ABC+DE
  • 7. C code for infix to postfix  Lets see some examples