假设您有两个集合,set1 非常大(几百万个值),而 set2 相对较小(几十万个值)。如果我想使用 .interstion() 函数获取这两个集合之间的值的交集,是否会根据输入的顺序改进运行时?
例如,其中一个会比另一个运行得更快吗?
set1.intersection(set2) set2.intersection(set1)
python runtime intersection set python-3.x
intersection ×1
python ×1
python-3.x ×1
runtime ×1
set ×1