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

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
(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
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
(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
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
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
 
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
 
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
 
(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
 
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
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...ranjana 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
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 

Recently uploaded (20)

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
(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...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
(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...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
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
 
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
 
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
 
(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
 
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
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
 
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...
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 

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