A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/dsa/introduction-to-queue-data-structure-and-algorithm-tutorials/ below:

Introduction to Queue Data Structure

Introduction to Queue Data Structure

Last Updated : 23 Jul, 2025

Queue is a linear data structure that follows FIFO (First In First Out) Principle, so the first element inserted is the first to be popped out.

FIFO Principle in Queue:

FIFO Principle states that the first element added to the Queue will be the first one to be removed or processed. So, Queue is like a line of people waiting to purchase tickets, where the first person in line is the first person served. (i.e. First Come First Serve).

Basic Terminologies of Queue Representation of Queue Queue Operations
  1. Enqueue: Adds an element to the end (rear) of the queue. If the queue is full, an overflow error occurs.
  2. Dequeue: Removes the element from the front of the queue. If the queue is empty, an underflow error occurs.
  3. Peek/Front: Returns the element at the front without removing it.
  4. Size: Returns the number of elements in the queue.
  5. isEmpty: Returns true if the queue is empty, otherwise false.
  6. isFull: Returns true if the queue is full, otherwise false.

For detailed steps and more information on each operation, Read Basic Operations for Queue in Data Structure.

Implementation of Queue Data Structure

Queue can be implemented using following data structures:

Complexity Analysis of Operations on Queue Operations Time Complexity

Space Complexity

enqueue O(1)

O(1)

dequeue O(1)

O(1)

front

O(1)

O(1)

size O(1)

O(1)

isEmpty O(1)

O(1)

isFull

O(1)

O(1)

Types of Queues

Queue data structure can be classified into 4 types:

  1. Simple Queue: Simple Queue simply follows FIFO Structure. We can only insert the element at the back and remove the element from the front of the queue. A simple queue is efficiently implemented either using a linked list or a circular array.
  2. Double-Ended Queue (Deque): In a double-ended queue the insertion and deletion operations, both can be performed from both ends. They are of two types:
  3. Priority Queue: A priority queue is a special queue where the elements are accessed based on the priority assigned to them. They are of two types:
types of queues Applications of Queue Data Structure

Application of queue is common. In a computer system, there may be queues of tasks waiting for the printer, for access to disk storage, or even in a time-sharing system, for use of the CPU. Within a single program, there may be multiple requests to be kept in a queue, or one task may create other tasks, which must be done in turn by keeping them in a queue.

Please refer Applications of Queue for more details.


Application of Queue Data structure

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4