Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by Limbic~Region (Chancellor)
on Oct 18, 2006 at 18:33 UTC ( [id://579165]=note: print w/replies, xml ) Need Help??


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

tye,
N = 26 always and I will have 25 different bitstrings for K = 1 .. 25. I am not sure I understand what you mean by your 1 bit per superset and then set the bit if that member is in the subset.
ABCDE = 00000 AC = 10100 DE = 10100 + 00011 = 10111 ?

Cheers - L~R

Replies are listed 'Best First'.
Re^3: Algorithm to convert combinations to bitstring (size)
by tye (Sage) on Oct 18, 2006 at 18:38 UTC

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

    - tye        

      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        

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-03-19 08:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found