### Question

in the context of this exercise, what is a good size to make a hash map?

### Answer

When determining the size of a hash map, it can be important to consider the concept of a load factor, which is the following ratio:

`n / k`

Here, `n`

is the total number of entries, and `k`

is the total number of buckets in the hash map. What size you make your hash map can depend on what load factor you want.

Usually, a good load factor is around **0.70 to 0.75**, which means that the number of buckets should be around 1.3 times as large as the number of entries in the hash map. The Java implementation of a HashMap uses this load factor because it “offers a good tradeoff between time and space costs”.

An important reason why you should consider the load factor when setting a size, is that hash maps should allow for quick assignment and retrieval. A good load factor accomplishes these because it can minimize collisions.

However, you are absolutely free to set your hash map size to any value you feel will work best for your dataset.