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

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
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
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
🌐
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 › programming › master python set intersection()
Master Python set intersection() [Practical Examples]
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.
🌐
Answers
math.answers.com › computer-science › What-is-the-time-complexity-of-finding-the-intersection-of-two-sets-in-python-using-the-set-intersection-operation
What is the time complexity of finding the intersection of two sets in Python using the set intersection operation? - Answers
February 8, 2025 - The time complexity of finding the intersection of two sets in Python using the set intersection operation is O(min(len(set1), len(set2)), where set1 and set2 are the two sets being intersected.
🌐
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) .