XIICSSTACK_INTRODUCTION cs

dhruvkuamr46 7 views 6 slides Sep 13, 2024
Slide 1
Slide 1 of 6
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6

About This Presentation

cs


Slide Content

TOPIC : INTRODUCTION OF STACK

Stack
•StackisalinearDataStructureimplementedinLIFO(LastInFirst
Out)mannerwhereinsertionanddeletionofelementare
performedonlyatoneendi.e.topofthestack.
•Itisacollectionofdataitemsinwhichdataitemsareinsertedand
deletedfromthetopofstack.
•TheremovalofelementfromstackiscalledPOPoperation.
•TheinsertionofnewelementatthetopofthestackiscalledPUSH
operation.
•StackisalsocalledDynamicDataStructurebecausethestack
implementedbylistcangrow(i.e.increasenumberofelements)
andshrink(i.e.decreasethenumberofelements)

Representation of Stack
with Push and Pop operations

Other Stack Terms
1-Overflow:-Itreferstothesituationwhenonetriesto
push(insert)aniteminstackthatisalreadyfull.This
situationoccurswhenthesizeofstackisfixedandcan
notgroworthereisnomemorylefttoaccommodate
newitem.
2-Underflow:-Itreferstothesituationwhenonetriesto
pop(delete)anitemfromtheemptystack.
3-Peek:-Itreferstoinspectingorgetthevaluefromthetop
ofthestacki.e.Peekmeanstoknowthetopmost
elementofstack

Illustrating Overflow and Underflow Condition

Illustrating Overflow and Underflow Condition
Tags