What is the time complexity of inserting an element into a queue which is implemented using an array?
What is the time complexity of inserting an element into a queue which is implemented using an array?
Solution
✅ Correct Option: 1
Inserting (enqueue) into an array-based queue only needs the rear index. The element is placed at the rear position and the rear pointer is incremented, as in followed by . No other element is shifted or traversed, so the time taken does not depend on and is .
Option 4: is the cost of dequeue only if the array is kept packed by shifting every element left after each removal, or of enqueue only if the whole array has to be copied when it is full. Neither is part of a normal enqueue.
Related questions:
2026: 18 May Shift 2
2025: 22 May Shift 1
2026: 26 May Shift 1
2025: 3 June Shift 2