Skip to main content

Section 6.1 Stack Terminology and Implementation

The stack represents a structure similar to a list, where elements can only be inserted or removed from one end. Although this limitation makes stacks less flexible compared to lists, it also makes them highly efficient and easy to implement for the operations they support. Many applications only require the limited set of insert and remove operations provided by stacks. In such cases, using the simpler stack data structure is more efficient than using a generic list. For instance, a freelist can be implemented using a stack.
Despite their restrictions, stacks find numerous applications, leading to the development of specialized terminology associated with stacks. Accountants have been using stacks long before computers were invented, referring to them as "LIFO" lists, which stands for "Last-In, First-Out." It is important to note that the LIFO policy of stacks means that elements are removed in the reverse order of their arrival.
The element that is accessible and can be manipulated on top of the stack is referred to as the top element. Elements are not inserted into a stack; rather, they are pushed onto the stack. Similarly, when an element is removed from a stack, it is popped. Here is a simple abstract data type (ADT) for a stack.
Here is a link to the OpenDSA textbook that shows how to implement linked stacks: Read Me 1 
You have attempted of activities on this page.
opendsa-server.cs.vt.edu/OpenDSA/Books/Everything/html/StackLinked.html