Hash Tables and Hashing
Similar to maps, a hash table is an associative array with keys and values. Hash tables turn the key into a hash code and then index the values based on the hash code. Since there can be an infinite amount of keys and a limited amount of hash codes, values sometimes have to share an index in the array. This means that the array itself has to be of some sort of list type to store multiple values (this is called chaining, there are other methods though). When values do have to share an index, it's called a collision. To find the value that you're looking for after values have collided, you must search through the list inside the index of the array.
The process of turning the key into a hash code is called hashing. Although hashing could be put into the algorithm section of these articles, it only makes sense to put it here so we can understand the entire process used with hash tables. There are many different ways to hash because it is essentially turning one value into another. The first value is the key (which can be of any type) and the second value is an int (within the bounds of a pre-made array). A common hashing practice is to turn a key into an integer (however you want) and then modulus it by the number of elements the array can hold. This will always give you an int value that is a valid index.
For this hash table, we are going to use linked lists to hold each key-value pair, and an array to hold all of the linked lists. For the hash function we will use the length of the string % 4, because 4 is the length of our example array.