Junior Collections

What is the time complexity for the operations Enqueue() and Dequeue() in a Queue<T>?

Follow:

  • Enqueue() → O(1) average case
  • Dequeue() → O(1) average case

Due to the internal circular array and pointer arithmetic, both operations are highly efficient

unless resizing is needed (which is O(n), but infrequent).

More from C# Programming Tutorial

All questions for this course