The python wiki on time complexity lists a single intersection as O(min(len(s), len(t)) where s and t are sets with the sizes len(s) and len(t), respectively. (In English: the time is bounded by and linear in the size of the smaller set.)

Note: based on the comments below, this wiki entry had been be wrong if the argument passed is not a set. I've corrected the wiki entry.

If you have n sets (sets, not iterables), you'll do n-1 intersections and the time can be (n-1)O(len(s)) where s is the set with the smallest size.

Note that as you do an intersection the result may get smaller, so although O is the worst case, in practice, the time will be better than this.

However, looking at the specific code this idea of taking the min() only applies to a single pair of sets and doesn't extend to multiple sets. So in this case, we have to be pessimistic and take s as the set with the largest size.

Answer from rocky on Stack Overflow
๐ŸŒ
Python-bloggers
python-bloggers.com โ€บ 2022 โ€บ 02 โ€บ python-set-intersection-the-ultimate-guide-for-beginners
Python Set Intersection โ€“ The Ultimate Guide for Beginners | Python-bloggers
February 7, 2022 - The time complexity of set intersection in Python on a set with n elements and a set argument with m elements is O(min(n, m)) because you need to check for the smaller set whether each of its elements is a member of the larger set.
Discussions

Time complexity of python set operations?
Python sets are powerful data ... tables, similar to dictionaries in Python but only storing keys without associated values. Due to their hash table implementation, most of the common operations on sets have efficient time complexities.... More on designgurus.io
๐ŸŒ designgurus.io
1
10
June 21, 2024
python - Intersection complexity - Stack Overflow
Given a large table and a randomized ... of the intersection algorithm "losing" are infinitesimally low and likely to never occur. 2022-09-01T14:53:29.527Z+00:00 ... Save this answer. ... Show activity on this post. The answer appears to be a search engine query away. You can also use this direct link to the Time Complexity page at python.o... More on stackoverflow.com
๐ŸŒ stackoverflow.com
algorithms - Time complexity of set intersection - Computer Science Stack Exchange
This problem involves the time-complexity of determining set intersections, and the algorithm must give output on all possible inputs (as described below). Problem 1: The input is a positive in... More on cs.stackexchange.com
๐ŸŒ cs.stackexchange.com
August 6, 2018
What's the fastest algorithm and data structure for set operations like intersection?
Let's say there are m elements in the first set, and n in the second set. In general, there's no way to find the result faster than O(m + n). (For some specific problems there may be a faster solution depending on what type of stuff is in the set.) So the main question is how to achieve O(m + n). The most common solution is to use a HashSet. For example: Insert all of the items from the first set (or the smaller set) into a HashSet. Then iterate over all of the items in the second set and test if any of them are in the HashSet. If so, add them to the intersection. Hash tables are generally O(1) to insert and look up. If you're not familiar with them I'd highly recommend learning how they work. More on reddit.com
๐ŸŒ r/learnprogramming
7
1
March 8, 2023
People also ask

What is the Time Complexity of Intersection Operations?
The time complexity of set intersection operations is generally O(min(len(A),len(B))) where ๏ฟฝA and ๏ฟฝB are the sets being intersected. This means that the operation's speed is determined by the size of the smaller set. It's one of the more efficient operations and can be particularly useful for large datasets, but keep performance considerations in mind for extremely large sets.
๐ŸŒ
golinuxcloud.com
golinuxcloud.com โ€บ home โ€บ python โ€บ master python set intersection() [practical examples]
Master Python set intersection() [Practical Examples] | GoLinuxCloud
What are the Limitations of Set Intersection?
One limitation of set intersection is that it can only be applied to sets, not to other iterable data types directly. To find the intersection between a list and a set, for example, you'd have to convert the list to a set first. Another limitation is that all elements in the set must be hashable, so you can't have sets of mutable types like lists or dictionaries. Also, using set intersection on very large sets may consume considerable memory and CPU resources, depending on the specific use-case.
๐ŸŒ
golinuxcloud.com
golinuxcloud.com โ€บ home โ€บ python โ€บ master python set intersection() [practical examples]
Master Python set intersection() [Practical Examples] | GoLinuxCloud
Is Set Intersection Commutative?
Yes, set intersection is commutative. This means that the order in which sets are intersected does not affect the outcome. In other words, A & B will yield the same result as B & A.
๐ŸŒ
golinuxcloud.com
golinuxcloud.com โ€บ home โ€บ python โ€บ master python set intersection() [practical examples]
Master Python set intersection() [Practical Examples] | GoLinuxCloud
๐ŸŒ
Finxter
blog.finxter.com โ€บ home โ€บ learn python blog โ€บ python set intersection()
Python Set intersection() โ€“ Be on the Right Side of Change
April 30, 2021 - The runtime complexity of the set.intersection() method on a set with n elements and a set argument with m elements is O(min(n, m)) because you need to check for the smaller set whether each of its elements is a member of the larger set.
๐ŸŒ
GoLinuxCloud
golinuxcloud.com โ€บ home โ€บ python โ€บ master python set intersection() [practical examples]
Master Python set intersection() [Practical Examples] | GoLinuxCloud
November 28, 2023 - Understanding the performance implications of using set operations like intersection can be crucial when you're working with large data sets. You can use Python's timeit library to measure the time taken for set operations.
๐ŸŒ
Eugene-eeo
eugene-eeo.github.io โ€บ blog โ€บ intersection-algorithms.html
Intersection Algorithms
However: Space complexity is essentially O(1) Time complexity is higher, at worse O(max(n,m)) due to the additional deletes. def intersection(A, B): b = len(B) - 1 a = len(A) - 1 # Find intersections, and set a to be the index # where the algorithm should search from for i in range(b, -1, -1): ...
Find elsewhere
๐ŸŒ
CSDN
devpress.csdn.net โ€บ python โ€บ 6304635dc67703293080c375.html
Time complexity of python "set.intersection" for n sets_python_Mangs-Python
August 23, 2022 - The python wiki on time complexity lists a single intersection as O(min(len(s), len(t)) where s and t are the sizes of the sets and t is a set.
๐ŸŒ
FavTutor
favtutor.com โ€บ blogs โ€บ set-intersection-python
Python Set Intersection with Examples and Codes
December 9, 2023 - Learn how to find the Intersection of sets in python using the intersection function and intersection operator with examples.
๐ŸŒ
TechNetExperts
technetexperts.com โ€บ home โ€บ optimizing array intersection to o(n+m) complexity
Optimizing Array Intersection to O(n+m) Complexity
February 20, 2026 - Because Python sets support efficient algebraic operations, the intersection can be calculated directly. The total time complexity of this approach is dominated by the initial set creation, resulting in an overall complexity of O(N + M).
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ internal-working-of-set-in-python
Internal working of Set in Python - GeeksforGeeks
July 11, 2025 - The time complexity for this operation is O(len(s1)), where s1 is the set from which elements are being subtracted. ... The symmetric difference between two sets is the set of elements that are in either of the sets but not in both.
๐ŸŒ
CodeSignal
codesignal.com โ€บ learn โ€บ courses โ€บ hashing-dictionaries-and-sets-in-python โ€บ lessons โ€บ mastering-python-sets-intersection-non-repeating-elements-and-unique-elements
Mastering Python Sets: Intersection, Non-Repeating ...
Next, we return a list with the elements in the seen set but not in the repeated set. Consequently, our final solution would look as follows: This approach results again in a time complexity of ... O(n)O(n) due to the constant time operations provided by the Python set.
๐ŸŒ
Betterdatascience
betterdatascience.com โ€บ python-set-intersection
Python Set Intersection - The Ultimate Guide for Beginners | Better Data Science
July 2, 2022 - In the last week’s article, youโ€™ve learned what Python set difference() is all about. Now weโ€™ll explore another commonly used set function. Python set intersection allows you to find common elements between two or more sets.
๐ŸŒ
Quora
quora.com โ€บ What-is-the-fastest-way-to-perform-a-Set-Intersection-in-big-Oh
What is the fastest way to perform a Set Intersection in big-Oh? - Quora
Answer: Depends a lot on what is the data structure used to implement the sets. If you are using sorted lists to represent the sets, you can simply walk through the two lists popping the larger element off the head, and recording a common element ...
๐ŸŒ
Python
wiki.python.org โ€บ moin โ€บ TimeComplexity
TimeComplexity - Python Wiki
As seen in the source code the complexities for set difference s-t or s.difference(t) (set_difference()) and in-place set difference s.difference_update(t) (set_difference_update_internal()) are different! The first one is O(len(s)) (for every element in s add it to the new set, if not in t).
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ intersection-function-python
Intersection() function Python - GeeksforGeeks
August 9, 2022 - Python Set clear() Method Syntax: Syntax: set.clear() parameters: The clear() method doesn't take any parameters. ร‚ Return: None Time complexity : The time complexity of set.clear() function on a set with n element is O(n) .