June 2020
Intermediate to advanced
382 pages
11h 39m
English
A stack is a linear data structure to store a one-dimensional list. It can store items either in Last-In, First-Out (LIFO) or First-In, Last-Out (FILO) manner. The defining characteristic of a stack is the way elements are added and removed from it. A new element is added at one end and an element is removed from that end only.
Following are the operations related to stacks:
isEmpty: Returns true if the stack is empty
push: Adds a new element
pop: Returns the element added most recently and removes it
The following diagram shows how push and pop operations can be used to add and remove data from a stack:

The top portion of the preceding ...