0% found this document useful (0 votes)
58 views2 pages

Understanding Queue with Linked List

A queue is a data structure that follows the FIFO (First In First Out) principle. Elements are inserted at the rear end and removed from the front end. Operations for inserting and removing elements are called enqueue and dequeue respectively. Using a linked list to implement a queue provides benefits over an array, including unlimited size and constant time for enqueue, dequeue, peek, isFull, and isEmpty operations.

Uploaded by

Vaibhav Mojidra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views2 pages

Understanding Queue with Linked List

A queue is a data structure that follows the FIFO (First In First Out) principle. Elements are inserted at the rear end and removed from the front end. Operations for inserting and removing elements are called enqueue and dequeue respectively. Using a linked list to implement a queue provides benefits over an array, including unlimited size and constant time for enqueue, dequeue, peek, isFull, and isEmpty operations.

Uploaded by

Vaibhav Mojidra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

About Queue(Using Linked List)

Queue is an abstract data structure, somewhat similar to Stacks. Unlike stacks, a queue
is open at both its ends. One end is always used to insert data (enqueue) and the other
is used to remove data (dequeue). Queue follows First-In-First-Out methodology, i.e.,
the data item stored first will be accessed first.

A queue can be defined as an ordered list which enables insert operations to be


performed at one end called REAR and delete operations to be performed at another
end called FRONT.

Queue is referred to as First In First Out list.

Insertion is known as enqueue

Deletion is known as dequeue

Benefit of using Linked List over array for


implementing Queue
Unlimited Size
dequeue() operation is constant O(1)
enque()
To add element in the queue from the rear
Big O: O(1) constant

dequeue()
To remove an element from the queue from the front.
Big O: O(1) constant

peek()
To read in front of the queue.
Big O: O(1) constant

isFull()
To read in front of the queue.
Big O: O(1) constant

isEmpty()
To read in front of the queue.
Big O: O(1) constant

References
Geeksforgeeks
Programiz
.

You might also like