What is the time complexity of popping elements from list in Python?
I wonder what the time complexity of the pop
method of list
objects is in Python (in CPython particulary). Also does the value of N
for list.pop(N)
affect the complexity?
performance of getting a new list with an additional value
To get a new list from a list with an additional value, I used to think that list_b = [*list_a, value]
is more performant than list_b = list_a + [value]
, as the latter generates an intermediate [value]
.