Comparison

Queue Operations Array Implementation Linked-List Implementation
Time Complexity Space Complexity Time Complexity Space Complexity
Enqueue  O (1) O (1) O (1) O (1)
Dequeue  O (1) O (1) O (1) O (1)
IsFull O (1) O (1) O (N) O (1)
IsEmpty O (1) O (1) O (1) O (1)
Peek O (1) O (1) O (1) O (1)

Related articles:



Name some Queue implementations and compare them by efficiency of operations

A queue is a linear data structure in which insertion is done from one end called the rear end and deletion is done from another end called the front end. It follows FIFO (First In First Out) approach. The insertion in the queue is called enqueue operation and deletion in the queue is called dequeue operation. 

A queue can be implemented in two ways:

  • Array implementation of queue
  • Linked List implementation of queue

Similar Reads

Array implementation of the queue:

For the array implementation of the queue, we have to take an array of size n. We also use two pointers front and rear to keep track of the front element and the last position where a new element can be inserted respectively. All the functionalities are satisfied by using these two pointers. For more details about array implementation of a queue refer to this link....

Linked List Implementation of the queue:

...

Comparison:

...