What is the time complexity of adding an element to the queue (enqueue…

2025

What is the time complexity of adding an element to the queue (enqueue operation)?

  1. A.

    O(1)

  2. B.

    O(n)

  3. C.

    O(n log n)

  4. D.

    O(n^2)

Attempted by 439 students.

Show answer & explanation

Correct answer: A

The time complexity of enqueue operation (adding an element to the end of the queue) is O(1) as it only takes a constant amount of time.

Explore the full course: Cocubes Preparation