CSL 102; Data Structures; IIIT Nagpur; Created by: Dr. Aniket Pingley
Introduction The concept of a stack has been discussed during the lectures on several occassions. It is a linear data structure that follows Last In First Out (LIFO) order for data-operations. Stack is an Abstract Data Type (ADT), commonly used in most programming languages. Similar to real-world stacks such as pile of plates, the stack data structure allows operation only from one end. The most common use of stack data structure in computers in the function call stack where memory management of input parameters, local variables, return addresses etc. is performed. During the lectures, we have seen how recursion is enabled using function call stack.
Image source: https://www.tutorialspoint.com/
Basic Operations
Following operations can be performed on a stack:
Animation for stack operations: https://www.cs.usfca.edu/~galles/visualization/StackArray.html
Implementation of Stack ADT