Python's list implementation uses a dynamically resized C array under the hood, removing elements usually requires you to move elements following after up to prevent gaps.

list.pop() with no arguments removes the last element. Accessing that element can be done in constant time. There are no elements following so nothing needs to be shifted.

list.pop(0) removes the first element. All remaining elements have to be shifted up one step, so that takes O(n) linear time.

Answer from Martijn Pieters on Stack Overflow
🌐
Medium
medium.com › @shuangzizuobh2 › how-well-do-you-code-python-9bec36bbc322
How slow is python list.pop(0) ?. An empirical study on python list.pop… | by Hj | Medium
September 27, 2023 - How slow is python list.pop(0) ? An empirical study on python list.pop complexity TL;DR Python list.pop(k) has a time complexity of O(n). Be cautious when use a python list as a Queue structure. Use …
🌐
Reddit
reddit.com › r/learnpython › does pop(i) have a time complexity of o(n) or o(k)?
r/learnpython on Reddit: Does pop(i) have a Time Complexity of O(n) or O(k)?
July 1, 2020 - The time complexity depends not on n, but on the index value to list.pop(), which is possibly a function of n, or not. For example, as n grows, any fixed negative index value to list.pop() will be O(1), and any fixed non-negative value will be O(n).
🌐
Medium
medium.com › @mollihua › pop-first-element-of-a-queue-in-python-list-pop-0-vs-collections-deque-popleft-7991408e45b
Pop first element of a queue in Python — list.pop(0) vs deque.popleft() | by mollihua | Medium
July 2, 2020 - Pop first element of a queue in Python — list.pop(0) vs deque.popleft() The time complexity of deque.popleft() is O(1), while the time complexity of list.pop(0) is O(k), as index 0 is considered an …
🌐
Quora
quora.com › What-is-the-time-complexity-of-the-pop-function-in-a-Python-list
What is the time complexity of the pop() function in a Python list? - Quora
Answer: Depends upon whether you pop from the end (which is the default when you pass no argument), or pop a specific position (which you can do, by passing an index number). Pop from the end is O(1) of course, but popping a specific position is O(n) because the list elements are then shifted to ...
🌐
Runestone Academy
runestone.academy › ns › books › published › pythonds3 › AlgorithmAnalysis › Lists.html
2.6. Lists — Problem Solving with Algorithms and Data Structures 3rd edition
Figure 3 shows the results of our experiment. You can see that as the list gets longer and longer the time it takes to pop(0) also increases while the time for pop stays very flat.
Find elsewhere
🌐
Finxter
blog.finxter.com › home › learn python blog › python list pop()
Python List pop() – Be on the Right Side of Change
June 19, 2021 - I’ve written a short script to evaluate runtime complexity of the pop() method in Python: import matplotlib.pyplot as plt import time y = [] for i in [100000 * j for j in range(5,15)]: lst = list(range(i)) t0 = time.time() x = lst.pop(0) t1 = time.time() y.append(t1-t0) plt.plot(y) plt.xlabel("List elements (10**5)") plt.ylabel("Time (sec)") plt.show()
🌐
Bomberbot
bomberbot.com › python › python-pop-how-to-pop-from-a-list-or-an-array-in-python
Python .pop() – How to Pop from a List or an Array in Python - Bomberbot
When discussing the performance of an operation like pop(), we need to consider its time and space complexity using Big O notation.
🌐
Python Morsels
pythonmorsels.com › time-complexities
Python Big O: the time complexities of different data structures in Python - Python Morsels
April 16, 2024 - That's what Python's collections.deque data structure is for. >>> from collections import deque >>> queue = deque([2, 1, 3, 4]) Here are the time complexities of common deque operations: Note that we can efficiently add and remove items from the beginning of a deque with the appendleft and popleft methods. If you find yourself calling the insert or pop methods on a list with an index of 0...
🌐
Python
wiki.python.org › moin › TimeComplexity
TimeComplexity - Python Wiki
The average case for an average value of k is popping the element the middle of the list, which takes O(n/2) = O(n) operations.
🌐
Medium
medium.com › @thakurinbox › time-complexity-of-popping-elements-from-list-in-python-215ad3d9c048
Time complexity of popping elements from list in Python! | by Naresh Thakur | Medium
December 13, 2021 - If we do a.pop(k)first remove and return the k'th and then moves all the elements after k one position up. So that we do not have null/empty/void value at k’th position. So what will be the time complexity when we pass an argument? Consider the length of list is N and we need to remove an element at k position as follows. ... # when we have to remove the first element O(N)# if we consider list we have above a = [1, 2, 3, 4, 5, 6] O(6-0) = O(6) = O(N)
🌐
CodeSignal
codesignal.com › learn › courses › linked-lists-stacks-and-queues-in-python › lessons › understanding-and-implementing-queues-exploring-core-concepts-python-implementation-and-time-complexity
Understanding and Implementing Queues: Exploring Core ...
In Python, we can implement Queues using built-in data types. Indeed, the Python list datatype comes in handy here. Python lists, however, have a significant drawback: the pop(0) method has · O · ( n · ) O(n)O(n) time complexity, while we would like it to be ·
🌐
DataCamp
datacamp.com › tutorial › python-pop
How to Use the Python pop() Method | DataCamp
July 31, 2024 - When we use the pop() method to remove the first or any other element, it works in O(n) time because it involves removing an element and shifting the other elements to a new index order. Check out our Analyzing Complexity of Code through Python tutorial to learn more about time complexity in Python.
🌐
Scribd
scribd.com › doc › 132591380 › python-list
Python List Operations Time Complexity | PDF
The document compares the time ... pop() operations have constant time complexity, while insert(0,1) and pop(0) have linear time complexity, as insert(0,1) and ......
🌐
Analytics Vidhya
analyticsvidhya.com › home › understanding python pop() method
Understanding Python pop() Method
October 12, 2024 - The efficiency of the pop() method depends on where in the list the element is being removed. Below are details on the time complexity for different scenarios:
🌐
Trajectory Hub
trajdash.usc.edu › home › redhat › mastering python pop: efficiently removing elements from lists and dictionaries
Mastering Python Pop: Efficiently Removing Elements from Lists and Dictionaries - Trajectory Hub
June 9, 2025 - When removing elements from large datasets, efficiency becomes a critical factor. The `pop(0)` operation on lists, for instance, has a time complexity of O(n) because all elements need to be shifted.
🌐
CodingNomads
codingnomads.com › python-301-use-a-list-in-stack-or-queue
Use a List in a Stack or Queue
Note that using .pop(0) is very slow, so you really shouldn't use this approach to model a queue in Python! Using a Python list as a queuehas very poor performance. This is because of how Python lists are designed. If you add an item to the beginning of a list, Python needs to shift all the other items, which means that the amount of time it takes will increase significantly if your list grows larger.