Help for this page

Select Code to Download


  1. or download this
    O( M+N + SIGMA( 2^3+2^4+...+2^n>N) + SIGMA( 2^3+...+2^m >M ) + MIN(N,M
    +) )
             memory for 1st hash         memory for 2nd hash       memory 
    +for 1 array*
    ## (*assuming you chose the smallest array to use with the 2hash/1 lis
    +t method)
    
  2. or download this
    O( M+N + SIGMA( 2^3+2^4+...+2^n>N) + N + M) )
             memory for smallest hash    memory for the two arrays
    ## for the 1 hash/2 arrays method.
    
  3. or download this
    C:\test>unionIntersect.pl -N=1e6 -MAX=27
           s/iter barvin    roy    buk   buk2
    ...
    buk      3.59   139%    35%     --   -15%
    buk2     3.05   182%    60%    18%     --
    
  4. or download this
    C:\test>unionIntersect.pl -N=5e5 -MAX=27
           s/iter barvin    buk    roy   buk2
    ...
    buk      2.80    39%     --   -17%   -30%
    roy      2.33    66%    20%     --   -16%
    buk2     1.95    98%    43%    19%     --
    
  5. or download this
    sub  buk2{
        my( $aRef, $bRef ) = @_;
    ...
        print 'buk2: ', $iCount, ' : ', $uCount if $SHOW;
        return( $iCount, $uCount );
    }