SlideShare a Scribd company logo
1 of 14
 Introduction
 What is expression ?
 Infix Expression
 Postfix Expression
 Priority table
 Algorithm for conversion
 Reference
• In this presentation we are going to read
about how to convert infix expression to
postfix expression with the help of STACK.
• A Stack is a linear data structure in which
item may be inserted and deleted at one
end called TOP.
• The operational meaning of stack is LIFO
i.e. Last In Fast Out.
• This means the last element is inserted to
the stack is the first element to be
deleted.
An expression is any legal combination of
operators and operands that represents a
value.
Operands are values and Operators are
symbols that represent particular actions.
Ex:-a+b,p*q etc.
• This expression is common expression for
writing arithmetic expression.
• In infix expression the binary operator
symbol is placed between its two operands.
Ex:-A+B,P*Q,(X+Y)/Z
• In postfix expression the binary operator
symbol placed after its two operands.
• This expression is also called ‘Reverse polish
expression’.
• It doesn’t require parenthesis to determine
the order of precedence.
Ex:-AB+,PQ*,XY+Z/
Priority level Operators
1. Unary +,Unary -,NOT
2. ^
3. /,*
4. +,-
5. <,>,<=,>=
6. ==,!=
7. &&
8. ||
POSTFIX(Q,P):Here Q is an infix expression.This
algorithm finds the equivalent postfix expression P.
Step 1:Take an empty stack ‘S’.
Step 2:Push ‘(’ to stack ‘S’ and add ‘)’ to given infix
expression.
Step 3:Scan infix expression for left to right & repeat
step 4-7 for each element of infix expression until
stack is empty
Step 4:If an OPERAND is encountered, add it
to postfix expression.
Step 5:If LEFT PARENTHESIS is encountered
push it into stack .
Step 6:If an OPERATOR is encountered, then
a. Repeatedly POP from stack and add
to postfix expression, each operator which
has same or as higher precedence then the
scanned operator.
b.Push the scanned operator to stack
[End of step 6 if structure]
Step 7:If a RIGHT PARENTHESIS is encountered
then:
a.Repeatedly POP from stack and add to
postfix expression,until a left parethesis is
encountered.
b.Remove the left parethesis from stack.
[End of step 7 if structure]
[End of step 3 loop]
Step 8:Exit
Q:-a+c*(d-e)^(b+c)-f)
Scanned item Stack Postfix expression
(
a ( a
+ (,+ a
c (,+ ac
* (,+,* ac
( (,+,*,( ac
d (,+,*,( acd
- (,+,*,(,- acd
e (,+,*,(,- acde
) (,+,* acde-
^ (,+,*,^ acde-
( (,+,*,^,( acde-
b (,+,*,^,( acde-b
+ (,+,*,^,(,+ acde-b
Scanned item Stack Postfix expression
c (,+,*,^,(,+ acde-bc
) (,+,*,^ acde-bc+
- (,- acde—bc+^*+
f (,- acde-bc+*^+f
) acde-bc+*^+f-
Postfix expression is acde-bc+*^+f-
Infix-Postfix expression conversion

More Related Content

What's hot

Applications of stack
Applications of stackApplications of stack
Applications of stackeShikshak
 
Deque and its applications
Deque and its applicationsDeque and its applications
Deque and its applicationsJsaddam Hussain
 
Queue data structure
Queue data structureQueue data structure
Queue data structureanooppjoseph
 
Expression evaluation
Expression evaluationExpression evaluation
Expression evaluationJeeSa Sultana
 
Array operations
Array operationsArray operations
Array operationsZAFAR444
 
Evaluation of postfix expression
Evaluation of postfix expressionEvaluation of postfix expression
Evaluation of postfix expressionAkhil Ahuja
 
structure and union
structure and unionstructure and union
structure and unionstudent
 
Polish Notation In Data Structure
Polish Notation In Data StructurePolish Notation In Data Structure
Polish Notation In Data StructureMeghaj Mallick
 
Increment and Decrement operators in C++
Increment and Decrement operators in C++Increment and Decrement operators in C++
Increment and Decrement operators in C++Neeru Mittal
 
Switch statement, break statement, go to statement
Switch statement, break statement, go to statementSwitch statement, break statement, go to statement
Switch statement, break statement, go to statementRaj Parekh
 
Two dimensional arrays
Two dimensional arraysTwo dimensional arrays
Two dimensional arraysNeeru Mittal
 

What's hot (20)

Data structure by Digvijay
Data structure by DigvijayData structure by Digvijay
Data structure by Digvijay
 
Stacks
StacksStacks
Stacks
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
 
Deque and its applications
Deque and its applicationsDeque and its applications
Deque and its applications
 
Strings in C
Strings in CStrings in C
Strings in C
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
 
Queues
QueuesQueues
Queues
 
Expression evaluation
Expression evaluationExpression evaluation
Expression evaluation
 
Array operations
Array operationsArray operations
Array operations
 
Evaluation of postfix expression
Evaluation of postfix expressionEvaluation of postfix expression
Evaluation of postfix expression
 
structure and union
structure and unionstructure and union
structure and union
 
stack
stackstack
stack
 
Polish Notation In Data Structure
Polish Notation In Data StructurePolish Notation In Data Structure
Polish Notation In Data Structure
 
Stack - Data Structure
Stack - Data StructureStack - Data Structure
Stack - Data Structure
 
Java operators
Java operatorsJava operators
Java operators
 
Stack
StackStack
Stack
 
Increment and Decrement operators in C++
Increment and Decrement operators in C++Increment and Decrement operators in C++
Increment and Decrement operators in C++
 
Switch statement, break statement, go to statement
Switch statement, break statement, go to statementSwitch statement, break statement, go to statement
Switch statement, break statement, go to statement
 
Arrays
ArraysArrays
Arrays
 
Two dimensional arrays
Two dimensional arraysTwo dimensional arrays
Two dimensional arrays
 

Viewers also liked

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
 
My lecture infix-to-postfix
My lecture infix-to-postfixMy lecture infix-to-postfix
My lecture infix-to-postfixSenthil Kumar
 
Infix prefix postfix expression -conversion
Infix  prefix postfix expression -conversionInfix  prefix postfix expression -conversion
Infix prefix postfix expression -conversionSyed Mustafa
 
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 to-postfix examples
Infix to-postfix examplesInfix to-postfix examples
Infix to-postfix examplesmua99
 

Viewers also liked (7)

Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)
 
My lecture infix-to-postfix
My lecture infix-to-postfixMy lecture infix-to-postfix
My lecture infix-to-postfix
 
Infix prefix postfix expression -conversion
Infix  prefix postfix expression -conversionInfix  prefix postfix expression -conversion
Infix prefix postfix expression -conversion
 
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
Infix to postfixInfix to postfix
Infix to postfix
 
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 to-postfix examples
Infix to-postfix examplesInfix to-postfix examples
Infix to-postfix examples
 

Similar to Infix-Postfix expression conversion

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
 
Lecture_04.2.pptx
Lecture_04.2.pptxLecture_04.2.pptx
Lecture_04.2.pptxRockyIslam5
 
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
 
Unit 2 application of stack
Unit 2  application of stack Unit 2  application of stack
Unit 2 application of stack LavanyaJ28
 
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptxSTACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptxKALPANAC20
 
Stack_Overview_Implementation_WithVode.pptx
Stack_Overview_Implementation_WithVode.pptxStack_Overview_Implementation_WithVode.pptx
Stack_Overview_Implementation_WithVode.pptxchandankumar364348
 
Stack in Data Structure
Stack in Data StructureStack in Data Structure
Stack in Data StructureUshaP15
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manualnikshaikh786
 
Unit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptxUnit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptxYogesh Pawar
 
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
 

Similar to Infix-Postfix expression conversion (20)

Infix to Postfix Conversion.pdf
Infix to Postfix Conversion.pdfInfix to Postfix Conversion.pdf
Infix to Postfix Conversion.pdf
 
stack-111104232459-phpapp02.pdf
stack-111104232459-phpapp02.pdfstack-111104232459-phpapp02.pdf
stack-111104232459-phpapp02.pdf
 
DS UNIT1_STACKS.pptx
DS UNIT1_STACKS.pptxDS UNIT1_STACKS.pptx
DS UNIT1_STACKS.pptx
 
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
 
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
 
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
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
Unit 2 application of stack
Unit 2  application of stack Unit 2  application of stack
Unit 2 application of stack
 
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptxSTACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
 
Stack_Overview_Implementation_WithVode.pptx
Stack_Overview_Implementation_WithVode.pptxStack_Overview_Implementation_WithVode.pptx
Stack_Overview_Implementation_WithVode.pptx
 
Stack in Data Structure
Stack in Data StructureStack in Data Structure
Stack in Data Structure
 
Chapter 6 ds
Chapter 6 dsChapter 6 ds
Chapter 6 ds
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manual
 
Unit 3 stack
Unit   3 stackUnit   3 stack
Unit 3 stack
 
CH4.pptx
CH4.pptxCH4.pptx
CH4.pptx
 
Unit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptxUnit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptx
 
DS MOD2 (1) (1).pptx
DS MOD2 (1) (1).pptxDS MOD2 (1) (1).pptx
DS MOD2 (1) (1).pptx
 
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...
 

Recently uploaded

High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPramod Kumar Srivastava
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFAAndrei Kaleshka
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样vhwb25kk
 
MK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxMK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxUnduhUnggah1
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一fhwihughh
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfchwongval
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Jack DiGiovanna
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort servicejennyeacort
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsVICTOR MAESTRE RAMIREZ
 
Identifying Appropriate Test Statistics Involving Population Mean
Identifying Appropriate Test Statistics Involving Population MeanIdentifying Appropriate Test Statistics Involving Population Mean
Identifying Appropriate Test Statistics Involving Population MeanMYRABACSAFRA2
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfSocial Samosa
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024thyngster
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...Florian Roscheck
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPTBoston Institute of Analytics
 

Recently uploaded (20)

High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFA
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
 
MK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxMK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docx
 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdf
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business Professionals
 
Identifying Appropriate Test Statistics Involving Population Mean
Identifying Appropriate Test Statistics Involving Population MeanIdentifying Appropriate Test Statistics Involving Population Mean
Identifying Appropriate Test Statistics Involving Population Mean
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
 

Infix-Postfix expression conversion

  • 1.
  • 2.  Introduction  What is expression ?  Infix Expression  Postfix Expression  Priority table  Algorithm for conversion  Reference
  • 3. • In this presentation we are going to read about how to convert infix expression to postfix expression with the help of STACK. • A Stack is a linear data structure in which item may be inserted and deleted at one end called TOP. • The operational meaning of stack is LIFO i.e. Last In Fast Out. • This means the last element is inserted to the stack is the first element to be deleted.
  • 4. An expression is any legal combination of operators and operands that represents a value. Operands are values and Operators are symbols that represent particular actions. Ex:-a+b,p*q etc.
  • 5. • This expression is common expression for writing arithmetic expression. • In infix expression the binary operator symbol is placed between its two operands. Ex:-A+B,P*Q,(X+Y)/Z
  • 6. • In postfix expression the binary operator symbol placed after its two operands. • This expression is also called ‘Reverse polish expression’. • It doesn’t require parenthesis to determine the order of precedence. Ex:-AB+,PQ*,XY+Z/
  • 7. Priority level Operators 1. Unary +,Unary -,NOT 2. ^ 3. /,* 4. +,- 5. <,>,<=,>= 6. ==,!= 7. && 8. ||
  • 8. POSTFIX(Q,P):Here Q is an infix expression.This algorithm finds the equivalent postfix expression P. Step 1:Take an empty stack ‘S’. Step 2:Push ‘(’ to stack ‘S’ and add ‘)’ to given infix expression. Step 3:Scan infix expression for left to right & repeat step 4-7 for each element of infix expression until stack is empty
  • 9. Step 4:If an OPERAND is encountered, add it to postfix expression. Step 5:If LEFT PARENTHESIS is encountered push it into stack .
  • 10. Step 6:If an OPERATOR is encountered, then a. Repeatedly POP from stack and add to postfix expression, each operator which has same or as higher precedence then the scanned operator. b.Push the scanned operator to stack [End of step 6 if structure]
  • 11. Step 7:If a RIGHT PARENTHESIS is encountered then: a.Repeatedly POP from stack and add to postfix expression,until a left parethesis is encountered. b.Remove the left parethesis from stack. [End of step 7 if structure] [End of step 3 loop] Step 8:Exit
  • 12. Q:-a+c*(d-e)^(b+c)-f) Scanned item Stack Postfix expression ( a ( a + (,+ a c (,+ ac * (,+,* ac ( (,+,*,( ac d (,+,*,( acd - (,+,*,(,- acd e (,+,*,(,- acde ) (,+,* acde- ^ (,+,*,^ acde- ( (,+,*,^,( acde- b (,+,*,^,( acde-b + (,+,*,^,(,+ acde-b
  • 13. Scanned item Stack Postfix expression c (,+,*,^,(,+ acde-bc ) (,+,*,^ acde-bc+ - (,- acde—bc+^*+ f (,- acde-bc+*^+f ) acde-bc+*^+f- Postfix expression is acde-bc+*^+f-