A queue is implemented using an array such that ENQUEUE and DEQUEUE operations…

GATE · 2016 · CS · Set 1 · Computer Science & IT

A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT (\(n\) refers to the number of items in the queue)?

  1. A.

    Both operations can be performed in \(O(1)\) time

  2. B.

    At most one operation can be performed in \(O(1)\) time but the worst case time for the other operation will be \(Ω(n)\)

  3. C.

    The worst case time complexity for both operations will be \(Ω(n)\)

  4. D.

    Worst case time complexity for both operations will be \(Ω(logn)\)

Attempted by 1123 students.

Show answer

Correct answer: A

The worked solution is available to enrolled students.

Video solution available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…