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
wiki.python.org › moin › TimeComplexity
TimeComplexity
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).
Discussions

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
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
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
Data structure optimized for set intersection?
That's not possible. If A and B are disjoint, you are asking for a zero-cost operation. More on reddit.com
🌐 r/compsci
19
83
March 10, 2021
🌐
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.
🌐
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.
🌐
Eugene-eeo
eugene-eeo.github.io › blog › intersection-algorithms.html
Intersection Algorithms
However: ... 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): n = B[i] for j in range(a, -1, ...
Find elsewhere
🌐
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.
🌐
FavTutor
favtutor.com › blogs › set-intersection-python
Python Set Intersection with Examples and Codes
December 9, 2023 - Like mathematics, we can also find the intersections of the set in Python. It provides tools to the perform set intersection and generates a completely new set as the output. In this article, we will study how to find set intersections in Python along with examples and output.
🌐
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).
🌐
Upgrad
upgrad.com › home › tutorials › software & tech › set in python
Set in Python: An In-Depth Guide
October 26, 2025 - Python sets use hash tables, offering fast average-case time complexity for actions like addition, removal, and membership checks.
🌐
Hero Vired
herovired.com › learning-hub › topics › python-sets
Python Sets - A Comprehensive Guide
July 27, 2024 - By understanding the basics of sets, their characteristics, and various operations, you can effectively use sets in your Python projects to solve complex problems with ease. From creating sets to performing union, intersection, and difference operations, this guide has covered everything you ...
🌐
Code and Debug
codeanddebug.in › home › data structures & algorithms › intersection of two linked lists | leetcode 160 | brute, better and optimal solutions
Intersection of Two Linked Lists | Leetcode 160 | Brute, Better and Optimal Solutions
July 15, 2025 - Person A walks route A then route B, while Person B walks route B then route A. Since they walk the same total distance, if their routes intersect, they’ll meet at the intersection point. It’s a beautiful mathematical solution that requires no extra calculations! The optimal approach is generally preferred because it’s the most elegant and uses constant space while maintaining the same time efficiency.
🌐
AmbitionBox
ambitionbox.com › interviews › question › how-do-you-find-the-intersection-point-of-two-arrays-chQAbtfL
How do you find the intersection point of two arrays?
Prepare for your next job interview with AmbitionBox. Read 12 Lakh+ interview questions & answers shared by real candidates across 1 Lakh+ companies in India.
🌐
Sarthaks eConnect
sarthaks.com › 3600377 › what-is-the-time-complexity-of-finding-union-or-intersection-of-two-linked-lists
What is the time complexity of finding Union or Intersection ...
February 24, 2024 - Join Sarthaks live online classes for 7-12, CBSE, State Board, JEE & NEET courses led by experienced expert teachers. Learn, Practice Test, Analyse and ace your exam.
🌐
Workat.tech
workat.tech › problem-solving › approach › sai › sorted-arrays-intersection
Sorted Arrays Intersection Editorial | Solution | Code
Practice and prepare for Machine Coding, Problem Solving and Data Structures, System Design (HLD) and Object Oriented Design (LLD) interview rounds. Compare, find and get job referrals at top tech companies.
🌐
PREP INSTA
prepinsta.com › home › data structures and algorithms in python › unordered sets in python
Unordered Sets In Python | DSA In Python | PrepInsta
August 5, 2025 - Set Operations: Perform set operations like union (|) and intersection (&). Comprehension: Create sets using comprehensions, e.g., {x**2 for x in range(1, 6)}. Copying Sets: Use copy method or set constructor for duplication. ... Fast Membership Testing: Sets provide fast average-case time complexity for membership testing (checking if an element is in the set).
🌐
OpenGenus
iq.opengenus.org › intersection-of-two-arrays
Intersection of two arrays
October 5, 2021 - In the best case scenario, there might be no common elements, and in that case the new list will have zero elements. So the space complexity would be O(1). ... Intersection of sets and set theory in general are widely used as foundation for fields like geometry, topology, calculus as well as chemistry, biology and other sciences.