3 ms·
I'm a big fan of the Fibonacci base: https://en.m.wikipedia.org/wiki/Fibonacci_coding https://en.m.wikipedia.org/wiki/Fibonacci_coding It has the nice property
by sdenton4 3y ago
I'm a big fan of the Fibonacci base: https://en.m.wikipedia.org/wiki/Fibonacci_coding https://en.m.wikipedia.org/wiki/Fibonacci_coding
It has the nice property that it's a) binary, and b) each number contains a '11' substring at the end, but nowhere else. This makes it slightly less efficient than the usual base 2 binary, but handles variable length integers nicely; you always know where one number ends and the next begins, so you don't have to worry about overflow or specifying the length of a number.