Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Set intersection problem

by Anonymous Monk
on May 23, 2023 at 09:20 UTC ( [id://11152383]=note: print w/replies, xml ) Need Help??


in reply to Set intersection problem

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11152383]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-29 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found