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:
Accessing an element by index is O(1) (constant time) — same as arrays.
Example:
int first = numbers[0]; // O(1)
Follow: