Q
How is a Python list implemented in CPython?
-
A
As a hash table
-
B
As a singly linked list
-
C
As a dynamic array of references, with amortized O(1) append
-
D
As a balanced tree
Correct Answer:
C. As a dynamic array of references, with amortized O(1) append
Explanation:
This is why indexing is O(1) and inserting at the front is O(n).