Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE-CS-2016 (Set 1) | Question 20

  • Difficulty Level : Basic
  • Last Updated : 12 Aug, 2021
Geek Week

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)?

(A) Both operations can be performed in O(1) time
(B) At most one operation can be performed in O(1) time but the worst case time for the other operation will be Ω(n)
(C) The worst case time complexity for both operations will be Ω(n)
(D) Worst case time complexity for both operations will be Ω(log n)


Answer: (A)

Explanation: We can use circular array to implement both in O(1) time. See below article for details.

 

 



Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :