Q: What is the time complexity of the enqueue and dequeue operations on a queue implemented using an array?
-
A
O(1)
-
B
O(log n)
-
C
O(n)
-
D
O(n log n)
A
Answer:
A
Explanation:
Answer: a) O(1)
Explanation: The enqueue and dequeue operations on a queue implemented using an array have a time complexity of O(1), since they simply involve adding or removing an element from the beginning or end of the array.
Related Topic:
Share Above MCQ