Queue – FIFO Data Structure

📘 Data Structure and Algorithm 👁 232 views 📅 Nov 05, 2025
⏱ Estimated reading time: 1 min

Queue – FIFO Data Structure

A queue is a linear data structure that follows the First-In-First-Out (FIFO) principle. The first element added is the first one to be removed.

Basic Operations

  • Enqueue: Insert an element at the rear.
  • Dequeue: Remove an element from the front.
  • Front: Get the first element.
  • Rear: Get the last element.

Implementation (C++)

queue<int> q;
q.push(10);
q.push(20);
q.pop();
cout << q.front();

Types of Queues

  • Simple Queue: Standard FIFO structure.
  • Circular Queue: Last element connects back to the first to reuse space.
  • Priority Queue: Elements are served based on priority, not order.
  • Deque: Double-ended queue allowing insertion/removal from both ends.

Applications

  • CPU scheduling and process management.
  • Handling requests in web servers.
  • Data streaming and buffering.
  • Print queue management.

Conclusion

Queues are essential for handling sequential processes and task scheduling. They provide orderly processing and are widely used in operating systems and network communication.


🔒 Some advanced sections are available for Registered Members
Register Now

Share this Post


← Back to Tutorials