ELI5: Explain Like I'm 5

Golomb coding

Okay kiddo, have you ever played with legos and tried to fit as many pieces as you can in a small container? Golomb coding is a little bit like that.

Let's say you have a bunch of numbers that you want to store in a computer, but you don't have a lot of space to store them. You want to squish them all together, but you still want to be able to take them apart and know which number is which.

Golomb coding helps you do that by taking each number and turning it into a bunch of little blocks just like legos. But instead of using actual legos, we use binary code which only has two blocks - a 0 and a 1.

First, we pick a number called the "divisor." This number helps us figure out how many blocks we need to use for each number we want to store. Let's say we pick the number 4 as the divisor.

If we want to store the number 6, we divide 6 by 4 and get a remainder of 2. This tells us we need two more blocks added to our lego tower. We start by putting a "1" block at the bottom to show the number is greater than 4, and then add two more "0" blocks to represent the remainder.

So the number 6 becomes "100". If we wanted to store the number 11, we would divide 11 by 4 and get a remainder of 3. This tells us we need three more blocks added to our tower. We start with a "1" block at the bottom, then add three "0" blocks and finish with a "1" block to represent the remainder. So the number 11 becomes "10011".

Golomb coding can help us save a lot of space when storing numbers because we only need to store the divisor and the binary code for each number. But it also helps us retrieve the original number because we know the divisor and how many blocks are in each binary code.

And that's the basics of Golomb coding!
Related topics others have asked about: