HashMap

Hashmap can be created using an Array.

We can have an array to store the (key, value) pair. For example, given a hashmap with default size = 4. We have

map = [(austin, 2), (github, 3), null, null]

When looking for the key austin. We take the hash of austin, let's say the result is 0.

Therefore, we know that we need to look into index 0 to find the key austin.

So in the array, we store the (key, value) in the index position of hash(key).

Things we need to watch out for: