Topics: Data Structure
A stack is a linear data structure in which we can only operate through one end (i.e. we can only insert or delete elements from one of its sides).
The elements in a stack are deleted in the order in which they were inserted; this is why stacks are also called LIFO-type structures (last in, first out).
Like lists, stacks can be contiguous or linked. Stacks have the following operations:
- Iteration through the stack
- Element insertion (push)
- Element deletion (pop)
- Element search