What is the time complexity of accessing a list element by index in Python?
Correct answer
A. O(1)
5 views
A. O(1)
5 views
Lists are backed by arrays, so index access takes constant time.
Asked in: Python Interview Lists
https://docs.python.org/3/tutorial/datastructures.htmlNot sure why the answer is A? Ask here and get an explanation.