Here is the listing of Python programming examples on Stacks & Queues.
1. Python Examples on Stack Implementation
Stack is a collection of objects that supports last-in first-out (LIFO) semantics for inserts and deletes. Insert and delete operations are also called as push and pop operations. Recursion is a way of programming a problem, in which a function calls itself one or more times in its body. The Python programs in this section deals with stack implementation, program to reverse a stack with and without using recursion, implementing stacks using one queue and two queues.
Python Program to Implement a Stack
Python Program to Reverse a Stack using Recursion
Python Program to Implement Stack using One Queue
Python Program to Implement Stack Using Two Queues
Python Program to Reverse a Stack without using Recursion
2. Python Examples on Queue Implementation
Queue works on the principle of First-in, first-out. collections.deque specially designed to have fast appends and pops from both the front and back end. Deque can be implemented in python using the module collections. Deque operations are append(), appendleft(), pop() and popleft(). This section contains Python programs on implementing queue and deque, implements queue using stacks, implement priority queue to add and delete elements.
Python Program to Implement Queue
Python Program to Implement Dequeue
Python Program to Implement Queues using Stacks
Python Program to Implement Priority Queue to Add and Delete Elements
3. Python Examples on String Implementation
The Python programs in this section deals with Stacks and Queues for string implementations. It contains programs to check whether the given string is palindrome or not and checks whether given expression is correctly parenthesized or not.
Python Program to Check String is Palindrome using Stack
Python Program to Check if Expression is correctly Parenthesized