SlideShare une entreprise Scribd logo
1  sur  5
STACK Applications Polish Notation
A + B
B
(
Step 1
A
Infix Expression
Postfix Expression
Stack
+
POST Fix
Algorithm : Postfix Using Stack
Step1: Insert ‘(‘ in the stack.
Step 2: Move from Left to Right in the Expression
Step 2.a: IF Operand Found
Put it on Expression
Step 2.b: IF Operator Found
Put it on Stack
Step 2.b.1: IF Operator’s precedence is Higher than
the top operator on the stack
Put it on Stack
Step 2.b.1: IF Operator’s precedence is Lower than
the top operator on the stack
Extract all higher precedence operators
from the stack and append them on expression
Step 2.b.1: IF ) found
Remove items on the stack till the ( found and
append them on post fix expression
Polish Notation
A + B
B
(
Step 1
A
Infix Expression
Prefix Expression
Stack
+
Pre Fix
Operand 1 Operand 2
B
Algorithm : Prefix Using Stack
Step1: Insert ‘(‘ in the stack.
Step 2: Move from Left to Right in the Expression
Step 2.a: IF Operand Found
Put it on Stack
Step 2.b: IF Operator Found
Put it on Head of the Expression
Step 2.b.1: IF ) found
Remove operands from the stack till the ( found
and append them on prefix expression
A + B
Infix Notation Prefix Notation
B
Queue
A
+
PREFIX Notation with Queue

Contenu connexe

Tendances

computer notes - Conversion from infix to postfix
computer notes - Conversion from infix to postfixcomputer notes - Conversion from infix to postfix
computer notes - Conversion from infix to postfix
ecomputernotes
 
computer notes - Evaluating postfix expressions
computer notes - Evaluating postfix expressionscomputer notes - Evaluating postfix expressions
computer notes - Evaluating postfix expressions
ecomputernotes
 
Stack data structure
Stack data structureStack data structure
Stack data structure
Tech_MX
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
greatqadirgee4u
 

Tendances (19)

Conversion of Infix To Postfix Expressions
Conversion of Infix To Postfix Expressions Conversion of Infix To Postfix Expressions
Conversion of Infix To Postfix Expressions
 
computer notes - Conversion from infix to postfix
computer notes - Conversion from infix to postfixcomputer notes - Conversion from infix to postfix
computer notes - Conversion from infix to postfix
 
Evaluation of postfix expression
Evaluation of postfix expressionEvaluation of postfix expression
Evaluation of postfix expression
 
computer notes - Evaluating postfix expressions
computer notes - Evaluating postfix expressionscomputer notes - Evaluating postfix expressions
computer notes - Evaluating postfix expressions
 
DATA STRUCTURE - STACK
DATA STRUCTURE - STACKDATA STRUCTURE - STACK
DATA STRUCTURE - STACK
 
Stack application
Stack applicationStack application
Stack application
 
Stack data structure
Stack data structureStack data structure
Stack data structure
 
Prefix, Infix and Post-fix Notations
Prefix, Infix and Post-fix NotationsPrefix, Infix and Post-fix Notations
Prefix, Infix and Post-fix Notations
 
Stack
StackStack
Stack
 
Stack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADTStack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADT
 
Stack Operation In Data Structure
Stack Operation In Data Structure Stack Operation In Data Structure
Stack Operation In Data Structure
 
Application of Stack - Yadraj Meena
Application of Stack - Yadraj MeenaApplication of Stack - Yadraj Meena
Application of Stack - Yadraj Meena
 
Stack
StackStack
Stack
 
Stacks in DATA STRUCTURE
Stacks in DATA STRUCTUREStacks in DATA STRUCTURE
Stacks in DATA STRUCTURE
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
 
Stacks
StacksStacks
Stacks
 
Expression evaluation
Expression evaluationExpression evaluation
Expression evaluation
 
Stack Data Structure V1.0
Stack Data Structure V1.0Stack Data Structure V1.0
Stack Data Structure V1.0
 
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
 

En vedette (10)

Reverse polish notation
Reverse polish notationReverse polish notation
Reverse polish notation
 
Pilha e Fila Estática
Pilha e Fila EstáticaPilha e Fila Estática
Pilha e Fila Estática
 
Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)
 
Infix to-postfix examples
Infix to-postfix examplesInfix to-postfix examples
Infix to-postfix examples
 
Infix prefix postfix expression -conversion
Infix  prefix postfix expression -conversionInfix  prefix postfix expression -conversion
Infix prefix 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
 
My lecture infix-to-postfix
My lecture infix-to-postfixMy lecture infix-to-postfix
My lecture infix-to-postfix
 
1.4 expression tree
1.4 expression tree  1.4 expression tree
1.4 expression tree
 
L3 cfg
L3 cfgL3 cfg
L3 cfg
 
Binary expression tree
Binary expression treeBinary expression tree
Binary expression tree
 

Similaire à Stack and queue -polish notations

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
haaamin01
 
Applicationsofstack 110805072322-phpapp01
Applicationsofstack 110805072322-phpapp01Applicationsofstack 110805072322-phpapp01
Applicationsofstack 110805072322-phpapp01
Jay Patel
 

Similaire à Stack and queue -polish notations (20)

Stack Applications
Stack ApplicationsStack Applications
Stack Applications
 
Postfix_to_prefix_conversion_stack Application.ppt
Postfix_to_prefix_conversion_stack Application.pptPostfix_to_prefix_conversion_stack Application.ppt
Postfix_to_prefix_conversion_stack Application.ppt
 
Postfix_to_prefix conversion-stack application.ppt
Postfix_to_prefix conversion-stack application.pptPostfix_to_prefix conversion-stack application.ppt
Postfix_to_prefix conversion-stack application.ppt
 
stack-111104232459-phpapp02.pdf
stack-111104232459-phpapp02.pdfstack-111104232459-phpapp02.pdf
stack-111104232459-phpapp02.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
 
Stack - Operations and Applications
Stack - Operations and ApplicationsStack - Operations and Applications
Stack - Operations and Applications
 
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 application
Stack applicationStack application
Stack application
 
Stack in Data Structure
Stack in Data StructureStack in Data Structure
Stack in Data Structure
 
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
 
stack-Intro.pptx
stack-Intro.pptxstack-Intro.pptx
stack-Intro.pptx
 
Unit 3 stack
Unit 3   stackUnit 3   stack
Unit 3 stack
 
STACK USING LISTS.pptx
STACK USING LISTS.pptxSTACK USING LISTS.pptx
STACK USING LISTS.pptx
 
Topic 2_revised.pptx
Topic 2_revised.pptxTopic 2_revised.pptx
Topic 2_revised.pptx
 
Infix to Postfix Conversion.pdf
Infix to Postfix Conversion.pdfInfix to Postfix Conversion.pdf
Infix to Postfix Conversion.pdf
 
Unit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptxUnit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptx
 
CH4.pptx
CH4.pptxCH4.pptx
CH4.pptx
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manual
 
Applicationsofstack 110805072322-phpapp01
Applicationsofstack 110805072322-phpapp01Applicationsofstack 110805072322-phpapp01
Applicationsofstack 110805072322-phpapp01
 
Chapter 6 ds
Chapter 6 dsChapter 6 ds
Chapter 6 ds
 

Plus de jyoti_lakhani

Ds06 linked list- insert a node after a given node
Ds06   linked list-  insert a node after a given nodeDs06   linked list-  insert a node after a given node
Ds06 linked list- insert a node after a given node
jyoti_lakhani
 
Ds01 data structure introduction - by jyoti lakhani
Ds01 data structure  introduction - by jyoti lakhaniDs01 data structure  introduction - by jyoti lakhani
Ds01 data structure introduction - by jyoti lakhani
jyoti_lakhani
 

Plus de jyoti_lakhani (20)

CG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsxCG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsx
 
Projections.pptx
Projections.pptxProjections.pptx
Projections.pptx
 
CG04 Color Models.ppsx
CG04 Color Models.ppsxCG04 Color Models.ppsx
CG04 Color Models.ppsx
 
CG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsxCG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsx
 
CG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptxCG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptx
 
CG01 introduction.ppsx
CG01 introduction.ppsxCG01 introduction.ppsx
CG01 introduction.ppsx
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
Double ended queue
Double ended queueDouble ended queue
Double ended queue
 
Tree terminology and introduction to binary tree
Tree terminology and introduction to binary treeTree terminology and introduction to binary tree
Tree terminology and introduction to binary tree
 
Priority queue
Priority queuePriority queue
Priority queue
 
Ds006 linked list- delete from front
Ds006   linked list- delete from frontDs006   linked list- delete from front
Ds006 linked list- delete from front
 
Ds06 linked list- insert a node after a given node
Ds06   linked list-  insert a node after a given nodeDs06   linked list-  insert a node after a given node
Ds06 linked list- insert a node after a given node
 
Ds06 linked list- insert a node at end
Ds06   linked list- insert a node at endDs06   linked list- insert a node at end
Ds06 linked list- insert a node at end
 
Ds06 linked list- insert a node at beginning
Ds06   linked list- insert a node at beginningDs06   linked list- insert a node at beginning
Ds06 linked list- insert a node at beginning
 
Ds06 linked list- intro and create a node
Ds06   linked list- intro and create a nodeDs06   linked list- intro and create a node
Ds06 linked list- intro and create a node
 
Ds04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhaniDs04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhani
 
Ds03 part i algorithms by jyoti lakhani
Ds03 part i algorithms   by jyoti lakhaniDs03 part i algorithms   by jyoti lakhani
Ds03 part i algorithms by jyoti lakhani
 
Ds03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhaniDs03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhani
 
Ds02 flow chart and pseudo code
Ds02 flow chart and pseudo codeDs02 flow chart and pseudo code
Ds02 flow chart and pseudo code
 
Ds01 data structure introduction - by jyoti lakhani
Ds01 data structure  introduction - by jyoti lakhaniDs01 data structure  introduction - by jyoti lakhani
Ds01 data structure introduction - by jyoti lakhani
 

Dernier

Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdf
Kamal Acharya
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Lovely Professional University
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 

Dernier (20)

Furniture showroom management system project.pdf
Furniture showroom management system project.pdfFurniture showroom management system project.pdf
Furniture showroom management system project.pdf
 
Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdf
 
Electrical shop management system project report.pdf
Electrical shop management system project report.pdfElectrical shop management system project report.pdf
Electrical shop management system project report.pdf
 
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
 
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and VisualizationKIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
 
Low rpm Generator for efficient energy harnessing from a two stage wind turbine
Low rpm Generator for efficient energy harnessing from a two stage wind turbineLow rpm Generator for efficient energy harnessing from a two stage wind turbine
Low rpm Generator for efficient energy harnessing from a two stage wind turbine
 
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility Applications
 
Introduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AIIntroduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AI
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
 
Attraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptxAttraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptx
 
"United Nations Park" Site Visit Report.
"United Nations Park" Site  Visit Report."United Nations Park" Site  Visit Report.
"United Nations Park" Site Visit Report.
 
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
 
How to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdfHow to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdf
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
 
BURGER ORDERING SYSYTEM PROJECT REPORT..pdf
BURGER ORDERING SYSYTEM PROJECT REPORT..pdfBURGER ORDERING SYSYTEM PROJECT REPORT..pdf
BURGER ORDERING SYSYTEM PROJECT REPORT..pdf
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
 
ChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdfChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdf
 

Stack and queue -polish notations

  • 1. STACK Applications Polish Notation A + B B ( Step 1 A Infix Expression Postfix Expression Stack + POST Fix
  • 2. Algorithm : Postfix Using Stack Step1: Insert ‘(‘ in the stack. Step 2: Move from Left to Right in the Expression Step 2.a: IF Operand Found Put it on Expression Step 2.b: IF Operator Found Put it on Stack Step 2.b.1: IF Operator’s precedence is Higher than the top operator on the stack Put it on Stack Step 2.b.1: IF Operator’s precedence is Lower than the top operator on the stack Extract all higher precedence operators from the stack and append them on expression Step 2.b.1: IF ) found Remove items on the stack till the ( found and append them on post fix expression
  • 3. Polish Notation A + B B ( Step 1 A Infix Expression Prefix Expression Stack + Pre Fix Operand 1 Operand 2 B
  • 4. Algorithm : Prefix Using Stack Step1: Insert ‘(‘ in the stack. Step 2: Move from Left to Right in the Expression Step 2.a: IF Operand Found Put it on Stack Step 2.b: IF Operator Found Put it on Head of the Expression Step 2.b.1: IF ) found Remove operands from the stack till the ( found and append them on prefix expression
  • 5. A + B Infix Notation Prefix Notation B Queue A + PREFIX Notation with Queue