4 ms·
Cpython lists are self-resizing arrays IIRC. That makes lookups O(1), insert / remove at the end O(1) amortized, insert / remove anywhere else O(n). In short: a
by algorias 15y ago
Cpython lists are self-resizing arrays IIRC. That makes lookups O(1), insert / remove at the end O(1) amortized, insert / remove anywhere else O(n). In short: append, extend and pop methods are efficient.