FOR FREE CONTENT

Stack

A stack is a linear list in which insertion (push) and deletion (pop) are performed at a fixed end of the list called the top of the stack i.e., TOS, and the last inserted element is removed first (LIFO or Last in First out).

 

Stack Operations

The basic operations that can be done on stacks are(S is a user-defined stack) - 

# push(S, element) – insert an element called element onto the stack

 

# pop(S) – removes and returns last inserted element 

 

# top(S) – returns (but not removed) the last inserted element i.e., the element on the top of the stack

 

# isEmpty(S) – returns true or false based on whether the stack is empty or not(also known as stack underflow)

 

# isFull(S) – returns true or false based on whether the stack is full or not (also known as stack overflow)

 

Stack Implementations

> Array-based

> Linked List-based

 

Here we cover some Stack Programs in C, C++, JAVA, and Python along with algorithms and time and space complexity analysis. It covers all courses like B.Sc Computer Sc., BCA, Btech, M.Sc Computer Sc., MCA and also school level Class 9, Class 10, Class 11 and Class 12.

 

Enjoy all Stack Programs:

1.  Stack Push and Pop Using Array

2.  Stack Using Linked List

3.  Infix to Postfix

4.  Postfix to Infix Conversion

5.  Postfix to Prefix Conversion

6.  Prefix to Postfix Conversion

7.  Infix Evaluation

8.  Postfix Evaluation

9.  Prefix Evaluation