You are on page 1of 15

Let’s Browse the

Back Button
When the game is with Data Structure.

Janhavi Karpe – 22102B2004


Same Window Tab

Link 1 Link 2 Link 3


dataStructure.ex linearData.ex Stackdata.ex
Same Window Tab

Link 1 Link 2 Link 3


dataStructure.ex linearData.ex Stackdata.ex
Same Window Tab

Link 1 Link 2 Link 4


dataStructure.ex linearData.ex ArrayData.ex
Stack : A Linear Data Structure

A B C D

0 1 2 3

•  Sequentially or linearly 
•  Traverse all the elements in single run only.
What are Stack’s Operations?

POP
PUSH Deleting the element
Inserting the element

Top
begin procedure push: PUSH()
stack, data
   if stack is full
      return null
   endif   
   top ← top + 1
   stack[top] ← data
end procedure

POP
PUSH Deleting the element
Inserting the element

Top
PUSH()

POP
PUSH Deleting the element
Inserting the element
Top
PUSH()

POP
PUSH Top Deleting the element
Inserting the element
POP()

POP
PUSH Deleting the element
Inserting the element
Top
begin procedure pop:
stack
   if stack is empty
      return null
   endif  
   data ← stack[top]
   top ← top - 1
   return data
end procedure
POP()

POP
PUSH Deleting the element
Inserting the element

Top
POP()

POP
PUSH Deleting the element
Inserting the element

Top
Stack

01 03
PUSH TOP
PUSH(Stack, Data) PEEK(Stack) / StackTop(Stack)

02 04
POP DISPLAY
POP(Stack) DISPLAY(Stack);
THANK YOU

You might also like