General Notes
Stack
Abstract Data Types: Defines a data structure by its behavior from the user's perspective, rather than its concrete implementation
Stack
- A list operating on the Last In First Out principle (LIFO).
- Push: Adding item to stack
- Pop: Removing item from the stack
- isEmpty: Checks if stack is empty
- The first item added to the stack is the last item that can be removed
- Implementing stack using array
- Declare an array to store the contents of stack
- Declare a stack pointer pointing to the index of last element added (Value -1 if stack is empty)
- Uses: Managing function calls, Syntax parsing in compilers, Recursion, 'Undo' functions, System memory architecture, Browsing history, Expression parsing (Reverse Polish Notation)
- Advantage: Simple, Efficient, Limited Memory, LIFO
- Disadvantage: Limited access, Random access not possible, Limited capacity leading to overflow
PYTHON
Python can be executed directly in the browser.
Editor — Python
Output
No output yet.
