Download Linked List implementation of Queue : [wpdm_package id=’1333′]
Download Array implementation of Queue : [wpdm_package id=’1335′]
Queue is a linear list of elements for which insertions are made at one end of the list and deletions are made at opposite end of the list. Queue data structure follow First in First out(FIFO) strategy, it means that we can dequeue or remove only element which was inserted first in the list. We can’t pop the elements from in between the list.
The following operations are possible in the Queue data structure –
1. IsEmpty() – returns weather the queue is empty or not
2. Size() – returns the size of the queue (number of elements in queue)
3. Enqueue(int el) – insert the element el into the queue
4. Dequeue() – dequeue(removes) an element from front of queue
5. Front() – display the very first inserted element in the queue
All the above mentioned operations are of O(1) time complexity.