what are the conditions under which operation on queue can take place ?
Define FIFO. mention it's connection with stak
Answers
Answered by
0
Answer:
Conditions under which operation on queue can take place -
- Enqueue - It is used to insert elements into the queue. Insertion can only happen at the Rear Pointer if the queue is not full.
- Dequeue - It is used to delete an element from queue. Deletion can only happen at the Front pointer if the queue is not empty.
FIFO - Queue is a Linear Data Structure. It follows FIFO Principle.
FIFO stands for FIRST IN AND FIRST OUT.
Connection with Stack -
Stack follows the LIFO (LAST IN FIRST OUT) order whereas Queue follows the FIFO Principle.
Both are Linear Data structures.
Explanation:
To track the elements of Queue, there are 2 pointers -
- Front Pointer - Deletion takes place
- Rear Pointer - Insertion takes place.
Real-Life Example - Imagine 10 persons standing one after another in a queue in front of the ticket booking center.
Similar questions