Google News
logo
Data Structures Algorithms - Quiz(MCQ)
If queue is implemented using arrays, what would be the worst run time complexity of queue and dequeue operations?
A)
Ο(1), Ο(n)
B)
Ο(1), Ο(1)
C)
Ο(n), Ο(n)
D)
Ο(n), Ο(1)

Correct Answer :   Ο(1), Ο(1)


Explanation : As queue is maintained by two separate pointers for queue and dequeue operations, the run time for both is Ο(1).

Advertisement