A Queue is a collection of objects that are inserted and removed using First in First out Principle(FIFO). Insertion is done at the back(Rear) of the Queue and elements are accessed and deleted from first(Front) location in the queue.
1. enqueue() : Adds element to the back of Queue. 2. dequeue() : Removes and returns the first element from the queue. 3. first() : Returns the first element of the queue without removing it. 4. size() : returns the number of elements in the Queue. 5. isEmpty() : Return True if Queue is Empty else return False. 6. printqueue() : Print all elements of the Queue.
Below is the implementation of the above mentioned Queue operations using Doubly LinkedList in Python:
Queue operations using doubly linked list queue elements are: 4->5->6->7-> first element is 4 Size of the queue is 4 After applying dequeue() two times queue elements are: 6->7-> queue is empty: False
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Priority Queue using doubly linked list
- Python | Stack using Doubly Linked List
- Difference between Singly linked list and Doubly linked list
- XOR Linked List – A Memory Efficient Doubly Linked List | Set 2
- XOR Linked List - A Memory Efficient Doubly Linked List | Set 1
- Construct a Doubly linked linked list from 2D Matrix
- QuickSort on Doubly Linked List
- Reverse a Doubly Linked List
- Reverse a Doubly Linked List | Set-2
- Doubly Linked List Tutorial
- Delete all the even nodes from a Doubly Linked List
- Sort the biotonic doubly linked list | Set-2
- Sort the biotonic doubly linked list
- Implementation of Deque using doubly linked list
- Reverse a doubly circular linked list
- Sort a k sorted doubly linked list
- Find pairs with given sum in doubly linked list
- Merge Sort for Doubly Linked List
- Doubly Linked List | Set 1 (Introduction and Insertion)
- Rotate Doubly linked list by N nodes
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.