Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Ultra compact set searching

by jimt (Chaplain)
on Nov 17, 2006 at 16:11 UTC ( #584748=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    
    Set of sets:
    ...
    
    I'm going to keep using the letters in the rest of the post, though, t
    +hey're easier to read.
    
  2. or download this
    
    A: (ABCD, ABCE, AEF, ABFG)
    ...
    
    So now we only need to check and see if BG is a subset of DFG or ABFG.
    + That's 2 checks instead of 5. Progress.
    
  3. or download this
    
    ABCDEFG
    ...
    
    So instead of listing the sets horizontally, I list them vertically. E
    +ach horizontal row is an element. Internally, each of those horizonta
    +l numbers there is stored as a new integer. So instead of storing "11
    +11000" for the set "ABCD", I store "11101" for the set of all sets ta
    +ht contain "A".
    
  4. or download this
    
      SSSSS
    ...
    B|11001
    G|00011
    
  5. or download this
    
    my %dispatch = ();
    ...
    my $func2 = and_maker(5);
    my $$results3 = $func2->(12,13,14,15,16);    # 5 args
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://584748]
Approved by Corion
Front-paged by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2019-12-14 09:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?