Re: Succint prefix-free code for integers?



Nyang A. Phra a écrit :
What I want to do is map integers from 0 ... inf to a prefix-free
code.

Now that's easy. Say I map

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

But that's not too handy for big numbers. I might try

0 0
1 100
2 101
3 11000
4 11001
5 11010
6 11011
...

Or something else. But what would be the most compact code? I'm
thinking that the prefix-generating bintree should have as high leaf-
node-to-depth -ratio as possible, but what would that mean in the case
where the bintree has to be infinite? Confused.

You seems to be looking for universal codes :
http://en.wikipedia.org/wiki/Universal_code_%28data_compression%29
You can try the Fibonacci or the taboo codes (similar to Fibonacci code, but with a parameter allowing it to better fit your need).
Steven Pigeon, who is active in this group (and invented the taboo codes), may be able to say you more about universal coding.

Nicolas
.