Syntactic Confectionery Delight | |
PerlMonks |
Re: Set intersection problemby Anonymous Monk |
on May 23, 2023 at 09:20 UTC ( [id://11152383]=note: print w/replies, xml ) | Need Help?? |
It's 2**n at worst and inductive: You get the solution S(i) for i sets by combining set s_i with all members of S(i-1). For i=2..n and S(1)={s_1} This can be further optimized - no point in trying (A/B)/C if A/C is empty - but 2**7 is only 128. To speed up intersection you can use hash slices in Perl or specialized CPAN modules.
In Section
Seekers of Perl Wisdom
|
|