Question:

The time complexity to perform an Enqueue operation on a Queue data structure is:

Show Hint

Insertion happens only at the rear, and the rear location is already known. No scan through the elements is needed.
Updated On: Jul 2, 2026
  • O(n)
  • O(n log n)
  • O(1)
  • O(log n)
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Step 1: Enqueue means inserting an element at the rear of the queue.

Step 2: A queue keeps a direct reference to the rear position. Whether it is built on an array with a rear index or a linked list with a tail pointer, the insertion happens at a known spot.

Step 3: Adding at that known spot needs a fixed number of actions: write the value and advance the rear pointer. No looping over existing elements is required.

Step 4: A fixed number of steps that does not depend on the number of elements \(n\) is constant time, written \(O(1)\). The correct option is (C).
Was this answer helpful?
0
0