Help for this page

Select Code to Download


  1. or download this
    
    Given the sets:
    ...
    ABCE
    ABD
    
  2. or download this
    
    ABCD
    ...
    
    This only requires 22 bytes of data, a 65% memory savings.
    
  3. or download this
    
    #first set generates normally
    ...
    
    internally, we only need to store ABCD, ABE, and EF for 3 bytes of dat
    +a stored - a 95.3% storage savings.
    
  4. or download this
    
    So if we added on ABF to the list, it would check as follows:
    ...
    is ABF a subset of EF?
        NO -> ABE < ABF, therefore ABF cannot be a subset of anything. Sto
    +p now and print ABE
    
  5. or download this
    
    So instead of:
    ...
        [qw(EF)]        #F slot
    );
    
  6. or download this
    
        [qw(ABE ABCD)],    #A slot
        [qw(ABE ABCD)],    #B slot
        [qw(EF)]        #F slot
    
  7. or download this
    
    (total number of sets) * (average length of sets) bytes of data.
    
    Let's say we have 10,000,000 sets with an average set length of 24. Th
    +at's only going to require 240,000,000 bytes to store (240 megabytes)
    +, which is slightly less than 1% of the total ram of the "store it al
    +l" approach.
    
  8. or download this
    
    To demonstrate the optimized version:
    ...
    We store 9 bytes and do 10 checks (determining "no checks" counts as a
    + check). Note - the original
    powerset version would also require 10 checks, so we're optimal here.