08/04/2025
What is Stack?
Stack is a powerful Abstract Data Type (ADT) that follows the Last-In-First-Out (LIFO) principle and allows dynamic data handling.
* Abstract Data Type (ADT):
A logical model, not concerned with how it’s implemented — only what it does (e.g., push, pop, peek).
* LIFO (Last-In-First-Out):
The most recently added element is the first one to be removed — like a stack of plates.
* Dynamic Nature:
Though it can be implemented using static arrays, stacks can also grow/shrink using dynamic memory (linked list or STL).