Unary Representation



Hi All,


Is there anyway to represent a binary string to unary
representation, with the samesize as the orignal string ?

FYI, unary coding

1 0
2 10
3 110
4 1110
5 11110
......

If I had a binary string of 111100001010011
Unary representation is 111011100001010

But if I had binary string of 000011110101100 (Inverse of
111100001010011)
Unary representation is 111011100001010

Hence both of the string 111100001010011 and 000011110101100 were
map to 111011100001010
then I will need extra one bit to say if it start with 1 or start with
0.

that will be one bit extra from the original string.

Is there any other way to represent a binary string to unary
representation yet maintain the size ?

Please advise.
Many thanks.
Ray



.



Relevant Pages

  • Re: Extracting bits out of huge numbers
    ... First if your question concerns the representation of binary numbers: ... ust a small example however just with 8 bit numbers. ... printfto get the binary string ... # the first character in this string is bit 7, tha last one is bit 0 ...
    (comp.lang.perl.misc)
  • Re: Chez Watt: Entropy in crystalization: up or down?
    ... So does your binary string represent all other possible universes as ... an infinite universe could be represented by a single infinite string. ... universe could contain its own binary representation. ... an error and retracts his assertion. ...
    (talk.origins)
  • Re: Chez Watt: Entropy in crystalization: up or down?
    ... So does your binary string represent all other possible universes as ... an infinite universe could be represented by a single infinite string. ... universe could contain its own binary representation. ... an error and retracts his assertion. ...
    (talk.origins)
  • Re: Convert Binary String to Hexadecimal
    ... The hexadecimal equivalent of the 32-bit binary string ... char *nl, *endp; ... value, create a text representation of that value, print the value ...
    (comp.lang.c)