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
.