It's O(n), also check out: http://wiki.python.org/moin/TimeComplexity

This page documents the time-complexity (aka "Big O" or "Big Oh") of various operations in current CPython. Other Python implementations (or older or still-under development versions of CPython) may have slightly different performance characteristics. However, it is generally safe to assume that they are not slower by more than a factor of O(log n)...

Answer from Zach Kelling on Stack Overflow
🌐
Python
wiki.python.org › moin › TimeComplexity
TimeComplexity
Internally, a list is represented as an array; the largest costs come from growing beyond the current allocation size (because everything must move), or from inserting or deleting somewhere near the beginning (because everything after that must move).
Discussions

Does pop(i) have a Time Complexity of O(n) or O(k)?
If time complexity of pop (first item) is O(n) and the time complexity for a set slice is O(k), why is my slicing function so slow? ... Complexity analysis of heappush, heappop and heapify in Python. ... I don't think I understand what the .pop() method does on a list.... More on reddit.com
🌐 r/learnpython
3
3
July 1, 2020
What is Python's list.append() method WORST Time Complexity? It can't be O(1), right?
Personally, I thought that lists worked as double LinkedLists, so insert time was O(1) But if it works as a dynamic array, time complexity should be amortized time, ie, close to O(1) but not quite More on reddit.com
🌐 r/learnpython
11
3
October 26, 2022
python - What is the time complexity to get the last index for an array? - Stack Overflow
array = ["A", "B", "C", "D"] for the given array it takes O(1) to point to the first index which is 0. So if I type array[0], it takes O(1) to point to "A". But if i write array[-1] which points to More on stackoverflow.com
🌐 stackoverflow.com
Time Complexity of Python list comprehension then list[i] = value vs. list = [] then list.append(value)
In terms of Big O the algorithms are equivalent to each other as they both have linear growth. As you say, the list comprehension in the first example is O(n) so the function is O(2n), but in algorithmic analysis that is considered equivalent to O(n). In practical terms the second approach is better as it only requires one iteration over the input array. More on reddit.com
🌐 r/learnprogramming
5
2
September 26, 2021
🌐
Medium
medium.com › @ivanmarkeyev › understanding-python-list-operations-a-big-o-complexity-guide-49be9c00afb4
Understanding Python List Operations: A Big O Complexity Guide | by Ivan Markeev | Medium
June 4, 2023 - Under the hood, lists use an underlying array structure to store their elements. This enables direct access to any element by index, resulting in O(1) complexity. Regardless of the size of the list, accessing an element takes the same amount of time.
🌐
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 - Share ... O(k) when k = n-1 is really the same as O(n) where time complexity is concerned. ... The time complexity depends not on n, but on the index value to list.pop(), which is possibly a function of n, or not.
🌐
DEV Community
dev.to › williams-37 › understanding-time-complexity-in-python-functions-5ehi
Understanding Time Complexity in Python Functions - DEV Community
October 25, 2024 - Inserting an Element: list.insert(index, value) → O(n) Inserting an element at a specific index requires shifting elements, resulting in linear time complexity. ... Removing an element (by value) requires searching for the element first, which ...
🌐
Codecademy
codecademy.com › docs › python › lists › .index()
Python | Lists | .index() | Codecademy
June 11, 2025 - In the worst case, the .index() method has O(n) time complexity, as it may need to check every element. Consider using dictionaries or other data structures that offer faster lookup times for frequently repeated searches on large lists.
🌐
Quora
quora.com › How-do-Python-lists-maintain-constant-time-complexity-for-indexing-if-their-elements-can-be-of-more-than-one-type
How do Python lists maintain constant time complexity for indexing if their elements can be of more than one type? - Quora
Answer (1 of 4): in a C arrays where the data is held in contiguous memory, you are right that indexing couldn’t be constant time in a heterogeneous container as you would have to sum the widths of all of the previous items before being able to fetch an item (or you would need to keep a separate ...
Find elsewhere
🌐
Analytics Vidhya
analyticsvidhya.com › home › how can i manipulate python list elements using indexing?
How can I Manipulate Python List Elements Using Indexing?
January 22, 2024 - Direct indexing has a time complexity of O(1), while using the index() method for searching has a time complexity of O(n). Opting for direct indexing can significantly improve efficiency for frequent index-based operations.
🌐
Bradfield CS
bradfieldcs.com › algos › analysis › performance-of-python-types
Performance of Python Types
In Python lists, values are assigned to and retrieved from specific, known memory locations. No matter how large the list is, index lookup and assignment take a constant amount of time and are thus
🌐
Python Morsels
pythonmorsels.com › time-complexities
Python Big O: the time complexities of different data structures in Python - Python Morsels
April 16, 2024 - The traversals that require more time are the ones that involve comparisons between more than just two values (like sorting every item). Efficient sorting is O(n log n) in time complexity terms.
🌐
GeeksforGeeks
geeksforgeeks.org › python › complexity-cheat-sheet-for-python-operations
Complexity Cheat Sheet for Python Operations - GeeksforGeeks
July 12, 2025 - This cheat sheet is designed to help developers understand the average and worst-case complexities of common operations for these data structures that help them write optimized and efficient code in Python. Python's list is an ordered, mutable sequence, often implemented as a dynamic array. Below are the time complexities for common list operations:
🌐
Reddit
reddit.com › r/learnpython › what is python's list.append() method worst time complexity? it can't be o(1), right?
r/learnpython on Reddit: What is Python's list.append() method WORST Time Complexity? It can't be O(1), right?
October 26, 2022 -

I know that lists in Python are implemented using arrays that store addresses to the information. Therefore, after several appends, when an array is loaded, it needs to reserve a new space and copy the entire array of addresses to the new place.

I've read on Stackoverflow that in Python Array doubles in size when run of space. So basically it has to copy all addresses log(n) times.

The bigger the list, the more copying it will need to do. So how can append operation have a Constant Time Complexity O(1) if it has some dependence on the array size

I assume since it copies addresses, not information, it shouldn't take long, python takes only 8 bytes for address after all. Moreover, it does so very rarely. Does that mean that O(1) is the average time complexity? Is my assumption right?

Top answer
1 of 4
4
I've read on Stackoverflow that in Python Array doubles in size when run of space It's actually not double, but it does increase proportional to the list size (IIRC it's about 12%, though there's some variance at smaller sizes). This does result in the same asymptotics though, so I'll assume doubling in the following description for simplicity. So basically it has to copy all addresses log(n) times. Not quite. Suppose we're appending n items to an empty vector. We will indeed do log(n) resizes, so you might think "Well, resizes are O(n), so log(n) resizes is n log(n) operations, which if we amortize over the n appends we did means n log(n)/n, or log(n) per append". However, there's a flaw in this analysis: we do not copy "all addresses" each of those times. Ie. the copies are not O(n). Sure, the last copy we do will involve copying n items, but the one before it only copied n/2, and so on. So we actually do 1 + 2 + 4 + ... + n copies, which sums to 2n-1. Divide that by n and you get ~2 operations per append - a constant. I assume since it copies addresses, not information We are indeed only copying the pointer, but this doesn't really matter for the complexity analysis. Even if it was copying a large structure, that'd only increase the time by a constant factor. Does that mean that O(1) is the average time complexity? It's the amortized worst case complexity (ie. what happens over a large number of operations). While any one operation can indeed end up doing O(n) operations, there's an important distinction that over a large number of operations, you are guaranteed to only be O(1), which is a distinction just talking about average case wouldn't capture.
2 of 4
2
Personally, I thought that lists worked as double LinkedLists, so insert time was O(1) But if it works as a dynamic array, time complexity should be amortized time, ie, close to O(1) but not quite
🌐
Plain English
python.plainenglish.io › exploring-python-lists-understanding-methods-operations-and-time-complexity-66242073716a
“Exploring Python Lists: Understanding Methods, Operations, and Time Complexity” | by Ewho Ruth | Python in Plain English
December 5, 2024 - The time complexity for accessing an element in a list by index is O(1) Here are some common operations on lists in Python along with real-world examples and their time complexities:
🌐
Stack Overflow
stackoverflow.com › questions › 54432475 › what-is-the-time-complexity-to-get-the-last-index-for-an-array › 54432512
python - What is the time complexity to get the last index for an array? - Stack Overflow
array = ["A", "B", "C", "D"] for the given array it takes O(1) to point to the first index which is 0. So if I type array[0], it takes O(1) to point to "A". But if i write array[-1] which points to
🌐
Analytics Vidhya
analyticsvidhya.com › home › python list index: a guide to finding and manipulating list elements
Python List Index: A Guide to Finding and Manipulating List Elements
January 23, 2024 - It is beneficial when dealing with large lists, as it has a time complexity of O(log n) compared to the linear time complexity of O(n) for sequential search. The list must be sorted in ascending order to use binary search for efficient list indexing.
🌐
GeeksforGeeks
geeksforgeeks.org › space-complexity-of-list-operations-in-python
Space Complexity of List Operations in Python - GeeksforGeeks
March 19, 2025 - Space Complexity: O(1), because it only returns the index and does not modify the list or create new structures.
🌐
The Teclado Blog
blog.teclado.com › time-complexity-big-o-notation-python
Time complexity and BigO Notation explained (with Python)
June 25, 2026 - The best example of an algorithm that has an O(logn) Time Complexity is "Binary Search". Binary search must be performed on a sorted list. Let's look at the implementation. # Iterative Binary Search Function # It returns the index of x in the given list if present, # else returns -1 def binary_search(lst, x): low = 0 high = len(lst) - 1 mid = 0 while low <= high: mid = (high + low) // 2 # If x is greater, ignore the left half if lst[mid] < x: low = mid + 1 # If x is smaller, ignore the right half elif lst[mid] > x: high = mid - 1 # means x is present in mid else: return mid # If we reach here, then the element was not present return -1 # Test list lst = [ 2, 3, 4, 10, 40 ] x = 10 # Function call result = binary_search(lst, x) if result != -1: print("Element is present at index", str(result)) else: print("Element is not present in list")
🌐
YouTube
youtube.com › codelines
python index time complexity - YouTube
Download this code from https://codegive.com In Python, understanding the time complexity of various operations is crucial for writing efficient and performa...
Published: December 11, 2023
Views: 1
🌐
LinkedIn
linkedin.com › all › engineering › computer science
How to Delete an Element from a Python List: 3 Methods
March 4, 2024 - Time complexity: O(n) due to list traversal. del list[index]: Directly deletes the element at the specified index without returning it. Time complexity: O(n) due to subsequent element shifting.
🌐
The-analytics
the-analytics.club › aussiebt › aussiebt casino login › a$4,500
How To Find The Index Of An Element In A List In Python?
January 17, 2022 - PayID withdrawals are the quickest option, often clearing the same day or by the next business day. Card withdrawals typically take longer. Some sources describe payments completing within about an hour, while player reports describe much longer waits, so treat any specific timeframe as indicative ...