1 Answers
Option 1 : Both operations can be performed in O(1) time
When we consider a normal implementation of the queue using an array, in that case for enqueue and dequeue operation, we have to shift every other element. In this, every time we remove the item from the start of the queue, all of the rest of the items in the queue move down by one to fill the space made by the removal of other items.
But if we consider the circular array implementation of a queue, in this case, both enqueue and dequeue can be performed in O(1) time.
Diagram
[ alt="F2 R.S Madhu 17.12.19 D4" src="//storage.googleapis.com/tb-img/production/19/12/F2_R.S_Madhu_17.12.19_D4.png" style="width: 658px; height: 405px;">