有n的不同大小的set
t1,t2,...,tn
将其n个set全部交集(这里用and当运算符号)起来
t1 and t2 and ... and tn
请问如何做效率能最好?
比如
A = {1, 2, 3}
B = {2, 3}
C = {1, 2}
D = {2}
(A and B) and (C and D)
= {2, 3} and {2}
= {2}
(((A and D) and B) and C
= (({2} and B) and C)
= {2} and C
= {2}
有不同的运算顺序
假设集合A与B作交集 n=|A| m=|B|
只需要O(n+m)