Professional Documents
Culture Documents
DS-PPT-session 8-Linear Ds
DS-PPT-session 8-Linear Ds
Presentation by
Mrs. N. Saranya
Assistant Professor (Sr.Gr)/ IT
Overview
Recap
Stack ADT
Queue ADT
Array Implementation of stack
Array Implementation of queue
Ai+1 Succeeds Ai
Ai-1 Preceeds Ai
Position of Ai is I
First element is A1
Last element is AN
Delete
Find
A[0] A[9]
10 20 30
10 20 30
10 50 20 30
10 20 30
10 20
A[0] A[1]
10 20 30 40
10 30 40
Pop() - deletion
Display
top 40
top 30 30 Stack full
top can’t insert
20 20 20 element 50
top 10 10 10 10
Don’t have
top element to
20 remove
10 top
10
Top=-1
Check for underflow
If we try to delete element from the empty stack then the condition is called stack underflow
Display the elements
Decrement the top
Display()
Display all the elements of stack