We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Resizing

Our current hashmap has a lot of collisions because we're using a fixed-size underlying list.

To reduce the chances of a collision, we can increase the number of slots in our hashmap. This is called resizing. This will not eliminate all possible collisions, but it will help reduce the chance of one happening.

When resizing, we create a new hashmap with more slots. Then, we re-insert all the key-value pairs from the old hashmap into the new hashmap.

Assignment