stack - PowerPoint PPT Presentation

Loading...

PPT – stack PowerPoint presentation | free to download - id: 2aaf25-Y2Y2M



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

stack

Description:

a simple view of how stack works – PowerPoint PPT presentation

Number of Views:523
Slides: 7
Provided by: dyners

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: stack


1
STACK DATA
Expert Arena
ea
  • STACK
  • LIFO ( Stack rule)
  • PUSH (function)
  • POP (function)
  • TOP (pointer)

2
  • Stack is also used for storing data.
  • Stack is like a container of memory.
  • In stack data first enter is last used and data
    last enter in memory is first used
  • Stack used LIFO method i.e
  • LAST IN FIRST OUT

3
A
  • Let given container be stack i.e bunch of memory
  • Data to be saved are A,B,C,D
  • so, data are saved in this form LIFO
  • First A will enter,
  • B ,
  • C ,
  • D

C
4
  • Now data is saved in this form
  • When we call out data the data will called as
    LIFO i.e. LAST IN FIRST OUT rule
  • So first D will be called of , than
  • C
  • B
  • A

C
A
5
  • Let given be the scenario with given stack, in
    which 2 data are already present.
  • There are 2 process in stack i.e POP PUSH
  • When we have to remove data from stack i.e top
    most data we calles POP function i.e. POP (top)
  • And when we have to insert data into stack we
    simply call PUSH ( data)

C
A
6
  • Let we have to remove B
  • C and D have to be inserted
  • There is another pointer called TOP that will
    point to highest position in stack
  • So here is process
  • POP (TOP) remove data B
  • PUSH (C)
  • PUSH (D)

C
TOP
TOP
A
TOP
About PowerShow.com