Question:easy

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

The Correct Option is C

Solution and Explanation

Idea: Count how the work grows with the queue size $n$.

For enqueue, the operation touches only the rear end. With a tail pointer (linked list) or a rear index (array), you place the new node and move the pointer forward. That cost is the same for an empty queue or a queue holding a million items.

\[T(n) = c \quad \text{(a constant, independent of } n)\]

An operation whose cost does not scale with $n$ is constant time. The linear, log-linear, and logarithmic choices all imply the work grows with $n$, which does not happen here.

\[\boxed{O(1)}\]
Was this answer helpful?
0