Stack: Elements can be inserted and deleted only from one side of the list, called the top. The insertion of an element is called push operation and the deletion of an element is called pop operation.
Queue: Elements can be inserted only from one side of the list called Rear, and the elements can be deleted only from the other side called the Front. It’s the insertion of an element in a queue is called an Enqueue operation and the deletion of an element is called a Dequeue operation.
- There are several types of queues such as : Simple Queue, Circular Queue, Priority Queue and Double Ended Queue
- We can implement a stack and queue using both array and linked list.
- Stack Applications: During Function Calls and Recursive Algorithms, Expression Evaluation, Undo feature in computer keyboard, Converting an Infix to Postfix, During Depth First Search (DFS) and Backtracking Algorithms etc.
- Queues Applications: Simulation, Scheduling, Shared Resource Management, Keyboard Buffer, Breadth-First Search, To handle congestion in the network etc.