ELI5: Explain Like I'm 5

Golomb-Rice code

Okay kiddo, let me explain something called Golomb-Rice code. Imagine you are at a candy store and you want to buy some candies, but the store only gives you choices in groups of 3. You might end up with some extra candies or not enough, right?

Golomb-Rice code helps solve this problem when we want to store numbers in a binary format. What it does is split the number into two parts: one part tells us how many times we need to group the number into 2 or more parts, and the other part tells us how many candies are left over in the last group.

Let's say we have the number 13. We want to split it into groups of 3, but we have 1 leftover candy at the end. The first part of the Golomb-Rice code would be the number of times we need to make groups of 2 or more. In this case, we can group 4 times. So the first part of the code would be 100, which is 4 in binary form.

Next, we need to look at how many candies are left over in the last group. As we said earlier, we have 1 candy left over. We convert 1 into binary form, which is 01. We insert this bit pattern after the first part of the code, which becomes 10001.

So we have just turned the number 13 into 10001 using Golomb-Rice code. This method is useful for storing numbers in a compressed format because it helps us avoid wasting space to represent the remainder that doesn't fit into a predetermined group.