SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Infix, prefix and postfix notation ,[object Object],[object Object],[object Object],[object Object],[object Object]
Basic operations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Some Rules ,[object Object],[object Object],[object Object],[object Object]
Infix Postfix A + B AB+ A+B-C AB+C- (A+B)*(C-D) AB+CD-* A$B*C-D+E/F/(G+H) AB$C*D-EF/GH+/+ ((A+B)*C-(D-E))$(F+G) AB+C*DE—FG+$ A-B/(C*D$E) ABCDE$*/-
Infix Prefix A + B +AB A+B+C -+ABC (A+B)*(C-D) *+AB-CD A$B*C-D+E/F/(G+H) +-*$ABCD//EF+GH ((A+B)*C-(D-E))$(F+G) $-*+ABC-DE+FG A-B/(C*D$E) -A/B*C$DE
Infix to Prefix notation (Example) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],4.  A-B/(C*D$E) A-B/(C*$DE) A-B/(*C$DE) A-/B(*C$DE) -A/B(*C$DE)
Example (Cont…) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example (Cont…) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Evaluating a postfix Expression (Algo) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Evaluate :- 6 2 3 + - 3 8 2 / + * 2 $ 3 + Symb opnd1 opnd2 value Opndstk 6 6 2 6,2 3 6,2,3 + 2 3 5 6,5 - 6 5 1 1 3 6 5 1 1,3 8 6 5 1 1,3,8 2 6 5 1 1,3,8,2 / 8 2 4 1,3,4 + 3 4 7 1,7 * 1 7 7 7 2 1 7 7 7,2 $ 7 2 49 49 3 7 2 49 49,3 + 49 3 52 52
Circular Queues ,[object Object],[object Object],[object Object],[object Object],[object Object]
Circular Queue (Insertion) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
55 44 33 22 11 22 11 55 44 11 55 44 33 22 4 3 2 1 0 1 0 4 3 0 4 3 2 1 Rear Front Front = 0 Rear = max – 1 Queue is full Rear Front Rear Front Front != 0 &  Rear = max-1 Rear = 0 A[rear] = val 33 2 Front !=0 &  Rear != max-1 Rear ++ A[rear] = val Inserting an element into queue (all conditions) Since if your queue is empty means (front=-1) then make front =0 & rear = 0 (by rear++) It will become 0 means(-1+1=0)
Circular Queue (Deletion) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
11 44 33 22 11 11 55 44 33 22 0 3 2 1 0 0 4 3 2 1 Rear Front Front = Rear Front = Rear = -1 Rear Front Rear Front If Front != max-1 & Front !=-1 Front ++ 55 4 Deleting an element into queue (all conditions) If (front=-1) then  Queue is empty If Front == max -1 Then Front = 0
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Converting an Expression from Infix to Postfix ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example – A + B * C Symb 1 A A 2 + A + 3 B AB + 4 * AB + * 5 C ABC + * 6 ABC* + 7 ABC*+
Example 2 (A+B) * C symb Postfix string opstk ( ( A A ( + A ( + B AB ( + ) AB+ * AB+ * C AB + C * AB + C*
Example 3    ((A – (B + C)) * D) $ (E + F) ( A ( ( A (( A A (( - AB ((- ( AB ((-( B ABC ((-( + ABC + ((-( + C ABC + -  ((-( + ) ABC + - ((- ) ABC + - D ( * ABC + - D ( D ABC + - D (* ) ABC + - D *  (* $ ABC + - D * ( ABC + - D * $ E ABC + - D * E $( + ABC + - D * E $( F ABC + - D * EF $( + ) ABC + - D * EF + $ ABC + - D * EF + $

Weitere ähnliche Inhalte

Was ist angesagt?

C++ Pointers And References
C++ Pointers And ReferencesC++ Pointers And References
C++ Pointers And References
verisan
 

Was ist angesagt? (20)

STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
 
Merge sort algorithm
Merge sort algorithmMerge sort algorithm
Merge sort algorithm
 
Carry look ahead adder
Carry look ahead adderCarry look ahead adder
Carry look ahead adder
 
Iteration
IterationIteration
Iteration
 
C++ Pointers And References
C++ Pointers And ReferencesC++ Pointers And References
C++ Pointers And References
 
Collision in Hashing.pptx
Collision in Hashing.pptxCollision in Hashing.pptx
Collision in Hashing.pptx
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
 
4. method overloading
4. method overloading4. method overloading
4. method overloading
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)
 
Data structures & algorithms lecture 3
Data structures & algorithms lecture 3Data structures & algorithms lecture 3
Data structures & algorithms lecture 3
 
Amortized analysis
Amortized analysisAmortized analysis
Amortized analysis
 
Data Structures - Lecture 10 [Graphs]
Data Structures - Lecture 10 [Graphs]Data Structures - Lecture 10 [Graphs]
Data Structures - Lecture 10 [Graphs]
 
Linked list
Linked listLinked list
Linked list
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 
Instruction format
Instruction formatInstruction format
Instruction format
 
Buses in a computer
Buses in a computerBuses in a computer
Buses in a computer
 
Queues
QueuesQueues
Queues
 
Evaluation of prefix expression with example
Evaluation of prefix expression with exampleEvaluation of prefix expression with example
Evaluation of prefix expression with example
 
Unit 4-booth algorithm
Unit 4-booth algorithmUnit 4-booth algorithm
Unit 4-booth algorithm
 

Andere mochten auch

My lectures circular queue
My lectures circular queueMy lectures circular queue
My lectures circular queue
Senthil Kumar
 
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
Haqnawaz Ch
 
Algorithm: priority queue
Algorithm: priority queueAlgorithm: priority queue
Algorithm: priority queue
Tareq Hasan
 

Andere mochten auch (20)

My lectures circular queue
My lectures circular queueMy lectures circular queue
My lectures circular queue
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
 
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
 
Algorithm: priority queue
Algorithm: priority queueAlgorithm: priority queue
Algorithm: priority queue
 
Queue as data_structure
Queue as data_structureQueue as data_structure
Queue as data_structure
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
Infix prefix postfix expression -conversion
Infix  prefix postfix expression -conversionInfix  prefix postfix expression -conversion
Infix prefix postfix expression -conversion
 
Infix to postfix conversion
Infix to postfix conversionInfix to postfix conversion
Infix to postfix conversion
 
Notation
NotationNotation
Notation
 
Circular Queue
Circular QueueCircular Queue
Circular Queue
 
Addressing modes of 8085
Addressing modes of 8085Addressing modes of 8085
Addressing modes of 8085
 
Expression evaluation
Expression evaluationExpression evaluation
Expression evaluation
 
Circular queue
Circular queueCircular queue
Circular queue
 
Polish nootation
Polish nootationPolish nootation
Polish nootation
 
Queue
QueueQueue
Queue
 
Stack
StackStack
Stack
 
Dsa circular queue
Dsa circular queueDsa circular queue
Dsa circular queue
 
Stack & queues
Stack & queuesStack & queues
Stack & queues
 
stacks in algorithems and data structure
stacks in algorithems and data structurestacks in algorithems and data structure
stacks in algorithems and data structure
 
Application of Stacks
Application of StacksApplication of Stacks
Application of Stacks
 

Ähnlich wie Circular queues

My lecture infix-to-postfix
My lecture infix-to-postfixMy lecture infix-to-postfix
My lecture infix-to-postfix
Senthil Kumar
 
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
 

Ähnlich wie Circular queues (20)

Stacks.ppt
Stacks.pptStacks.ppt
Stacks.ppt
 
Stacks.ppt
Stacks.pptStacks.ppt
Stacks.ppt
 
1.3- infix-ti-postfix.pdf
1.3- infix-ti-postfix.pdf1.3- infix-ti-postfix.pdf
1.3- infix-ti-postfix.pdf
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
 
5.stack
5.stack5.stack
5.stack
 
My lecture infix-to-postfix
My lecture infix-to-postfixMy lecture infix-to-postfix
My lecture infix-to-postfix
 
Running Free with the Monads
Running Free with the MonadsRunning Free with the Monads
Running Free with the Monads
 
DS1.pptx
DS1.pptxDS1.pptx
DS1.pptx
 
Stack
StackStack
Stack
 
Stacks in DATA STRUCTURE
Stacks in DATA STRUCTUREStacks in DATA STRUCTURE
Stacks in DATA STRUCTURE
 
Stack_Application_Infix_Prefix.pptx
Stack_Application_Infix_Prefix.pptxStack_Application_Infix_Prefix.pptx
Stack_Application_Infix_Prefix.pptx
 
Data structures
Data structures Data structures
Data structures
 
Stack - Data Structure - Notes
Stack - Data Structure - NotesStack - Data Structure - Notes
Stack - Data Structure - Notes
 
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
2.2 stack applications Infix to Postfix & Evaluation of Post Fix2.2 stack applications Infix to Postfix & Evaluation of Post Fix
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
 
Lect-28-Stack-Queue.ppt
Lect-28-Stack-Queue.pptLect-28-Stack-Queue.ppt
Lect-28-Stack-Queue.ppt
 
Data Structure and Algorithms Stacks
Data Structure and Algorithms StacksData Structure and Algorithms Stacks
Data Structure and Algorithms Stacks
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacks
 
Stacks,queues,linked-list
Stacks,queues,linked-listStacks,queues,linked-list
Stacks,queues,linked-list
 
Infix prefix postfix
Infix prefix postfixInfix prefix postfix
Infix prefix postfix
 
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
 

Mehr von Ssankett Negi (10)

Binary tree
Binary treeBinary tree
Binary tree
 
Multi way&btree
Multi way&btreeMulti way&btree
Multi way&btree
 
Heapsort
HeapsortHeapsort
Heapsort
 
Binary trees
Binary treesBinary trees
Binary trees
 
Threaded binarytree&heapsort
Threaded binarytree&heapsortThreaded binarytree&heapsort
Threaded binarytree&heapsort
 
U3.stack queue
U3.stack queueU3.stack queue
U3.stack queue
 
Stack prgs
Stack prgsStack prgs
Stack prgs
 
Recursion
RecursionRecursion
Recursion
 
Qprgs
QprgsQprgs
Qprgs
 
U2.linked list
U2.linked listU2.linked list
U2.linked list
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Circular queues

  • 1.
  • 2.
  • 3.
  • 4. Infix Postfix A + B AB+ A+B-C AB+C- (A+B)*(C-D) AB+CD-* A$B*C-D+E/F/(G+H) AB$C*D-EF/GH+/+ ((A+B)*C-(D-E))$(F+G) AB+C*DE—FG+$ A-B/(C*D$E) ABCDE$*/-
  • 5. Infix Prefix A + B +AB A+B+C -+ABC (A+B)*(C-D) *+AB-CD A$B*C-D+E/F/(G+H) +-*$ABCD//EF+GH ((A+B)*C-(D-E))$(F+G) $-*+ABC-DE+FG A-B/(C*D$E) -A/B*C$DE
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. Evaluate :- 6 2 3 + - 3 8 2 / + * 2 $ 3 + Symb opnd1 opnd2 value Opndstk 6 6 2 6,2 3 6,2,3 + 2 3 5 6,5 - 6 5 1 1 3 6 5 1 1,3 8 6 5 1 1,3,8 2 6 5 1 1,3,8,2 / 8 2 4 1,3,4 + 3 4 7 1,7 * 1 7 7 7 2 1 7 7 7,2 $ 7 2 49 49 3 7 2 49 49,3 + 49 3 52 52
  • 11.
  • 12.
  • 13. 55 44 33 22 11 22 11 55 44 11 55 44 33 22 4 3 2 1 0 1 0 4 3 0 4 3 2 1 Rear Front Front = 0 Rear = max – 1 Queue is full Rear Front Rear Front Front != 0 & Rear = max-1 Rear = 0 A[rear] = val 33 2 Front !=0 & Rear != max-1 Rear ++ A[rear] = val Inserting an element into queue (all conditions) Since if your queue is empty means (front=-1) then make front =0 & rear = 0 (by rear++) It will become 0 means(-1+1=0)
  • 14.
  • 15. 11 44 33 22 11 11 55 44 33 22 0 3 2 1 0 0 4 3 2 1 Rear Front Front = Rear Front = Rear = -1 Rear Front Rear Front If Front != max-1 & Front !=-1 Front ++ 55 4 Deleting an element into queue (all conditions) If (front=-1) then Queue is empty If Front == max -1 Then Front = 0
  • 16.
  • 17.
  • 18. Example – A + B * C Symb 1 A A 2 + A + 3 B AB + 4 * AB + * 5 C ABC + * 6 ABC* + 7 ABC*+
  • 19. Example 2 (A+B) * C symb Postfix string opstk ( ( A A ( + A ( + B AB ( + ) AB+ * AB+ * C AB + C * AB + C*
  • 20. Example 3  ((A – (B + C)) * D) $ (E + F) ( A ( ( A (( A A (( - AB ((- ( AB ((-( B ABC ((-( + ABC + ((-( + C ABC + - ((-( + ) ABC + - ((- ) ABC + - D ( * ABC + - D ( D ABC + - D (* ) ABC + - D * (* $ ABC + - D * ( ABC + - D * $ E ABC + - D * E $( + ABC + - D * E $( F ABC + - D * EF $( + ) ABC + - D * EF + $ ABC + - D * EF + $