Give any two characteristics of stacks.
Answer
A stack is like a stack of books
The Characteristics of Stacks are:
- It is a data structure which follows LIFO (Last-in-First-Out)
- The insertion and deletion happens at the same end i.e. from the top of the stack
- Stack is implemented through Array or Linked list .
- Stack is used in many algorithms like Tower of Hanoi, tree traversals.
- If the allocated space for stack is full , and any attempt to add more elements will lead to stack Overflow . The opposite , any attempt to extract elements on an empty stack leads to Stack Underflow .
![Slide2.JPG](https://d1avenlh0i1xmr.cloudfront.net/c8bf8b2b-5a8e-42be-a659-3a0b85b181c9/slide2.jpg)
![Slide3.JPG](https://d1avenlh0i1xmr.cloudfront.net/cb50e2ae-f69d-4f1e-9ae4-2c2847aa41f9/slide3.jpg)