ELI5: Explain Like I'm 5

Extendible hashing

Okay kiddo, have you heard of a very big cupboard where your mom keeps all the snacks she buys for you? Imagine if there are lots and lots of snacks and you want to find a particular snack quickly without looking through every single one. That's where extendible hashing comes in.

Extendible hashing is like the cupboard where every snack has a number assigned to it. To find a snack, you just need to remember its number and go straight to the right spot in the cupboard without checking every single one.

In extendible hashing, instead of snacks, we have data like names or numbers. We assign each data a number, like 1 or 2 or 3. Then, we group them together based on how many digits they share. For example, all numbers that start with 1 are grouped together, all numbers that start with 2 are grouped together, and so on.

Now, imagine there are too many groups and the cupboard is full. What do we do? We can add more space by adding another section to the cupboard. But how do we remember which number is in which section now that we have more sections? That's where extendible hashing gets even cooler.

We use binary numbers, like 01, 10, 11, to represent each section. Each data's number is converted to binary, and the left most digits become the section number. So if a data's number is 10111, it will go to section 10, because its binary number starts with 10.

Now, if we add another section, we only need to add one more binary digit to represent that section, like 100. All the existing data stays in the same section, and only the new data that starts with 100 will go to the new section.

That's just a simple example, but extendible hashing allows us to add more space to store data efficiently, without having to move or reorganize all the existing data, and without using too much memory. Pretty cool, right?
Related topics others have asked about: