Loading

Quipoin Menu

Learn • Practice • Grow

data-structure-with-java / Queue Introduction
tutorial

Queue Introduction

Imagine a line of people waiting for a ticket. The first person in line gets served first. This is First In, First Out (FIFO) behavior. A queue is a linear data structure that follows FIFO principle.

A queue has two primary operations:
  • enqueue – add an element to the rear
  • dequeue – remove an element from the front
  • front – view the front element without removing it
  • isEmpty – check if queue is empty

Queues are used in CPU scheduling, print spooling, breadth-first search (BFS), and message queues.

Here's a simple queue interface in Java:


public interface Queue<T> {
void enqueue(T item);
T dequeue();
T front();
boolean isEmpty();
int size();
}
Two Minute Drill
  • Queue is a FIFO data structure.
  • Main operations: enqueue, dequeue, front, isEmpty.
  • Used in scheduling, BFS, buffers.
  • Can be implemented using arrays or linked lists.

Need more clarification?

Drop us an email at career@quipoinfotech.com