Q. What does the enQueue operation do?
Simulator
What is Queue?
A Queue is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO). A good example of a queue is any queue of consumers for a resource where the consumer that came first is served first. The difference between stacks and queues is in removing. In a stack we remove the item the most recently added; in a queue, we remove the item the least recently added.
Linear Queue operations:
1. enQueue(Insert new element).
2. deQueue(Delete element).
3. isFull(Check if Queue is full).
4. isEmpty(Check if Queue is empty).
5. display(Display all queue elements).
Time complexity:
1. enQueue O(1).
2. deQueue O(n).
3. isFull O(1).
4. isEmpty O(1).
5. display O(n).
Drawbacks:
1. Time Complexity of Dequeue : O(n)
or.
2. Can't reuse free space.
Run
What is queue?
Queue implementation using array
Data/Variables:
Free
Used
Array size: Min(5) & Max(9)
F
R
Operations
enQueue
deQueue
isFull
isEmpty
display
Reset