


What exactly does our robot do? It analyzes the item we want to store and maps it to a location to store it in. Let’s bring our robot back one last time: The example we saw earlier with our robot very efficiently storing and retrieving items sets us up nicely for looking at our next intermediate stop, the hashing function. Based on its analysis of the fish replica, it knows where to go and it goes there without any dilly-dallying. It doesn’t scan other boxes looking for our fish. The important thing to note, just like we saw earlier when our robot was storing items, is that our robot goes directly to the correct box. Once it has figured out where our fish is, it goes directly to the right box and brings it back to us: This analysis helps our robot to determine which box our actual edible fish is stored in: We have an exact replica of it (possibly a picture!), and the first thing our robot does is analyze the replica. We are in the mood for some fish, so we tell our robot to retrieve our fish. We want to retrieve a food item that we had stored earlier. We repeat this process a few more times for different types of food that we want to store, and our robot analyzes and stores the food in the appropriate box: It analyzes it, determines which box to store it in, and then stores it in the appropriate box: The important part is that, at the end of this analysis, our robot has a clear idea of where to store our watermelon: The exact logic our robot uses isn’t important for us to focus on right now. This analysis tells our robot which box to put our watermelon into. Our robot comes up to the watermelon and analyzes it: To help us here, we are going to rely on a trusted robot helper:Īs our first action, we decide to store our watermelon. Our goal is to take some of our food and store it in these boxes for safekeeping. We also have a bunch of boxes to store this food into: We have a bunch of food that we need to store: Here is the setup that will help us explain how hashtables work. In this tutorial, we’ll go deep into what makes hashtables (often also referred to as hashmaps or dictionaries) really awesome. We’ll see hashtables used by other data structures and algorithms for their functioning. For this reason, we’ll find hashtables used in the many MANY situations where we need to cache data for quick access later. It takes storing and retrieving values really quickly to a whole new level. When it comes to data structures, the hashtable holds a special place in all of our hearts.
