Q. What does the enQueue operation do?
In a linked queue, each node of the queue consists of two parts i.e. data part and the link part. Each element of the queue points to its immediate next element in the memory.
In the linked queue, there are two pointers maintained in the memory i.e. front pointer and rear pointer. The front pointer contains the address of the starting element of the queue while the rear pointer contains the address of the last element of the queue.
Insertion and deletions are performed at rear and front end respectively. If front and rear both are NULL, it indicates that the queue is empty.
1. enQueue(Insert new element).
2. deQueue(Delete element).
3. isEmpty(Check if Queue is empty).
4. display(Display all queue elements).
1. enQueue O(1).
2. deQueue O(1).
3. isEmpty O(1).
4. display O(n).