Junior Collections

What is the time complexity of accessing an element in a List<T>?

Accessing an element by index is O(1) (constant time) — same as arrays.

Example:

int first = numbers[0]; // O(1)

Follow:

More from C# Programming Tutorial

All questions for this course