stacks stack is collection of objects that are inserted and removed according to the last-infirst-out (lifoprinciple user may insert objects into stack at any timebut may only access or remove the most recently inserted object that remains (at the so-called "topof the stackthe name "stackis derived from the metaphor of stack of plates in spring-loadedcafeteria plate dispenser in this casethe fundamental operations involve the "pushingand "poppingof plates on the stack when we need new plate from the dispenserwe "popthe top plate off the stackand when we add platewe "pushit down on the stack to become the new top plate perhaps an even more amusing example is pez (rcandy dispenserwhich stores mint candies in spring-loaded container that "popsout the topmost candy in the stack when the top of the dispenser is lifted (see figure stacks are fundamental data structure they are used in many applicationsincluding the following example internet web browsers store the addresses of recently visited sites in stack each time user visits new sitethat site' address is "pushedonto the stack of addresses the browser then allows the user to "popback to previously visited sites using the "backbutton example text editors usually provide an "undomechanism that cancels recent editing operations and reverts to former states of document this undo operation can be accomplished by keeping text changes in stack figure schematic drawing of pez (rdispensera physical implementation of the stack adt (pez (ris registered trademark of pez candyinc