Conceptually, the stack abstract data type mimics the information kept into a pile on a desk. Informally, first we consider a material on a desk, where we might keep separate stacks for bills that require paying, magazines that we plan to read, & notes we have taken. We can carry out various operations that involve a stack:
- Begin a new stack;
- Place new information onto the top of a stack;
- take the top item off of stack;
- read the item onto the top; and
- Find out whether a stack is empty. (There might be nothing at the spot where the stack must be).
While discussing these operations, this is conventional to call the addition of an item to the top of the stack as push operation & the deletion of an item from the top as a pop operation. (These terms are derived through the working of a spring-loaded rack having a stack of cafeteria trays. Such a rack is loaded through pushing the trays down on the springs as each diner eliminates a tray, the lessened weight on to the springs cause the stack to pop up slightly).