Professional Documents
Culture Documents
NPTELIITGuwahati
STACKapileofelements:
Printthispage
Introduction:
1.Stackisbasicallyadataobject
2.Theoperationalsemantic(meaning)ofstackisLIFOi.e.lastinfirstout
Definition:Itisanorderedlistofelementsn,suchthatn>0inwhichallinsertionsanddeletionsaremade
atoneendcalledthetop.
Primaryoperationsdefinedonastack:
1.PUSH:addanelementatthetopofthelist.
2.POP:removetheatthetopofthelist.
3.Also"IsEmpty()"andIsFull"function,whichtestswhetherastackisemptyorfullrespectively.
Example:
1.Practicaldailylife:apileofheavybookskeptinaverticalbox,disheskeptoneontopofanother
2.Incomputerworld:Inprocessingofsubroutinecallsandreturnsthereisanexplicituseofstackof
returnaddresses.
Alsoinevaluationofarithmeticexpressions,stackisused.
Largenumberofstackscanbeexpressedusingasingleonedimensionalstackonly.Suchanarrayis
calledamultiplestackarray.
TestYourSkills:Prob.1Prob.2
Prev
http://nptel.ac.in/courses/106103069/32
Next
1/1