• Save
Stack
Upcoming SlideShare
Loading in...5
×
 

Stack

on

  • 7,719 views

 

Statistics

Views

Total Views
7,719
Slideshare-icon Views on SlideShare
7,370
Embed Views
349

Actions

Likes
4
Downloads
0
Comments
1

6 Embeds 349

http://www.ustudy.in 329
http://ustudy.in 13
http://www.brijj.com 3
http://www.slideshare.net 2
https://twimg0-a.akamaihd.net 1
http://webcache.googleusercontent.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Stack Stack Presentation Transcript

    • S T A C K Based on Chapter 3 Of Reference Book #1
    • Reference Books
          • Data Structures and Algorithm Analysis in C
            • By Mark Allen Weiss
              • Published by Addison Wesley
          • Data Structures (Schaum’s Outline Series)
            • By Seymour Lipschutz
              • Published by Mc Graw Hill
    • A STACK Model
      • Definitions
        • A STACK is a list with the restriction that insertion and deletion can be performed in only one position.for that reason it is called LIFO (last in first out ) structure.
        • The end where insertion and deletion can be performed is called the end of the list or top.
      • Set of operations
        • PUSH , i nserts a new element at the end or top .
        • POP , deletes or remove most recently inserted element from top.
        • TOP, retrieves most recently inserted element from top.
        • isEmpty , returns the status of emptiness of the stack.
        • A pop operation on top on an empty stack is considered as an error.
        • A push on a full stack cause a overflow condition.
    • Stack Model
    • Implementation
        • As Linked List
          • PUSH = insertion at front of the list.
          • POP = retrieving and deletion at the front of the list
          • TOP = retrieving the value of the front node
    • Linked List implementation Declarations
    • Linked List implementation Empty Test Create Stack
    • Linked List implementation PUSH TOP
    • Linked List implementation POP
    • Implementation
        • As Array
          • Define an Array ‘ Stack ’ of sufficient capacity to store stack elements.
          • Uses a variable i.e TopOfStack to remember the position of TOP.
          • TopOfStack = -1 for an empty stack.
          • PUSH:
            • Set TopOfStack = TopOfStack +1
            • Set Stack[TopOfStack] = X
          • POP:
            • Return Stack[TopOfStack]
            • Set TopOfStack = TopOfStack –1
    • Array implementation Declarations
    • Array implementation Create Stack
    • Array implementation Free the Stack Check for Empty stack
    • Array implementation Empty the Stack PUSH
    • Array implementation TOP POP TOP and POP
    • Applications Postfix Notation
    • Applications Postfix Notation 6 5 2 3 + 8 * + 3 + *
    • Applications Postfix Notation 6 5 2 3 + 8 * + 3 + *
    • Applications Postfix Notation 6 5 2 3 + 8 * + 3 + *
    • Applications Infix to Postfix a + b * c + ( d * e + f ) * g
    • Applications Infix to Postfix a + b * c + ( d * e + f ) * g
    • Applications Infix to Postfix a + b * c + ( d * e + f ) * g
    • Applications Infix to Postfix a + b * c + ( d * e + f ) * g
    • Applications Infix to Postfix a + b * c + ( d * e + f ) * g
    • Applications Infix to Postfix a + b * c + ( d * e + f ) * g
    • Applications Infix to Postfix a + b * c + ( d * e + f ) * g
    • Applications Infix to Postfix a + b * c + ( d * e + f ) * g
    • Applications Infix to Postfix a + b * c + ( d * e + f ) * g Function Calls ( another application )
    • a + b * c + ( d * e + f ) * g Infix to Postfix a + b * c + ( d * e + f ) * g a + b * c + ( d * e + f ) * g + * + ( * + ) *