in reply to Re^2: Algorithm to convert combinations to bitstring (size)
in thread Algorithm to convert combinations to bitstring

26 bits isn't very many so A=2**0=1, B=2**1=2, ..., Z=2**25=0x2000000. ABZ=0x2000003.

- tye        

  • Comment on Re^3: Algorithm to convert combinations to bitstring (size)

Replies are listed 'Best First'.
Re^4: Algorithm to convert combinations to bitstring (size)
by Limbic~Region (Chancellor) on Oct 18, 2006 at 18:44 UTC
    tye,
    Ok, I think what you are saying is count in base-N even though you don't need all the bits? If that's the case then yes, it may make things easier and the extra space shouldn't be that much more.

    Cheers - L~R

      That was my alternative (in an update) if K is small (or near N). That uses log2( N**K ) bits.

      But what I described above is using base 2. It uses only N bits no matter how large (or small) K is, and the translation doesn't depend on K either. It can describe any subset of your superset, not just subsets of size K.

      - tye