Stack Data Structures Overview

stack n.w
1 / 14
Embed
Share

"Explore the fundamentals of stack data structures in this detailed content developed by Misha Ann Alexander. Learn about stack operations, applications, infix to postfix conversions, and more. Discover how stacks work with examples and illustrations."

  • Stack
  • Data Structures
  • Operations
  • Applications
  • Conversions

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. STACK CHAPTER 03 Developed By :- Misha Ann Alexander Data Structures

  2. STACK Stacks are linear lists. All deletions and insertions occur at one end of the stack known as the TOP. Data going into the stack first, leaves out last. Stacks are also known as LIFO data structures (Last-In, First-Out). Developed By :- Misha Ann Alexander Data Structures

  3. STACK Developed By :- Misha Ann Alexander Data Structures

  4. OPERATIONS ON THE STACK push Adds an item to the top of a stack. pop Removes an item from the top of the stack and returns it to the user. Developed By :- Misha Ann Alexander Data Structures

  5. STACK DATA :- 10,20,30,40,50,60 PUSH 10 PUSH 20 PUSH 30 PUSH 40 PUSH 50 .. 40 TOP TOP 30 20 TOP 10 TOP Developed By :- Misha Ann Alexander Data Structures

  6. STACK OPERATIONS POPPED ELEMENTS 40 30 20 40 TOP TOP 30 20 TOP 10 Developed By :- Misha Ann Alexander Data Structures

  7. APPLICATIONS OF STACK INFIX TO POSTFIX CONVERSION INFIX TO PREFIX CONVERSION STRING REVERSE EVALUATION OF POSTFIX EXPRESSION CHECK WHETHER THE EXPRESSION IS VALID OR NOT Developed By :- Misha Ann Alexander Data Structures

  8. INFIX TO POSTFIX CONVERSION EXPRESSIONS Prefix: + a b Infix: a + b Postfix: a b + Developed By :- Misha Ann Alexander Data Structures

  9. INFIX TO POSTFIX CONVERSION There are two methods ---- Manual method(Parenthesis) ----- stack method Developed By :- Misha Ann Alexander Data Structures

  10. MANUAL METHOD(INFIX TO POSTFIX) A+b *d/e A+(b *d)/e A+((b *d)/e) ( A + ( ( b * d )/e ) ) ABD*E/+ Developed By :- Misha Ann Alexander Data Structures

  11. MANUAL METHOD(INFIX TO PREFIX) A+b *d/e A+(b *d)/e A+((b *d)/e) ( A + ( ( b * d )/e ) ) +A/*BDE Developed By :- Misha Ann Alexander Data Structures

  12. INFIX TO POSTFIX USING STACK A + B * C - D / E InfixStack(bot->top) a) A + B * C - D / E b) + B * C - D / E c) B * C - D / E d) * C - D / E e) C - D / E f) - D / E g) D / E h) / E i) E j) k) Postfix + - / + + + * + * + - + - + - / A A A B A B A B C A B C * A B C * D A B C * D A B C * D E A B C * D E / - + Developed By :- Misha Ann Alexander Data Structures

  13. INFIX TO PREFIX USING STACK Reverse the infix string . Replace ( with ) and ) with ( . Convert it to postfix. Reverse the result. Developed By :- Misha Ann Alexander Data Structures

  14. POSTFIX EVALUATION Operand: push Operator: pop 2 operands, do the math, pop result back onto stack 1 2 3 + * Postfix a) b) c) d) e) f) Stack( bot -> top ) 1 2 3 + * 2 3 + * 3 + * + * * 5 1 1 2 1 2 3 1 5 // 5 from 2 + 3 // 5 from 1 * 5 Developed By :- Misha Ann Alexander Data Structures

More Related Content