What is a Queue
A Queue is a data structure which stores data sequentially and only its first element can be accessed. A queue is similar to an Array but cannot be accessed at any index like in an array. Only the first index can be accessed in a queue. Thus, the queue follows the FIFO principle – First In First Out principle (FIFO).
Applications of Queue:
A Queue is usually used in applications where data is needed to be processed successively in one direction.
- Instruction Pipeline/Task Scheduling
- Event Queues/Event Handling
Dequeue
Dequeue is a Double-ended Queue. It is similar to a queue, but data can be inserted or removed from both ends of the queue.
Applications of Dequeue:
Dequeue is usually used in applications where data must be processed sequentially but in both directions.
- Storing web browser’s history. Navigating Back & forth in web history requires a double-ended queue.
- Undo & Redo operations
Add Comment