

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 9
click for more info
Not enough gems
Cost: 6 gems
1: Hashmaps
incomplete
2: Hash Function
incomplete
3: Insert
incomplete
4: Get
incomplete
5: Hash Map Review
incomplete
6: Resizing
incomplete
7: Linear Probing
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
In the previous lessons, we've built a basic hash map that can add and retrieve key-value pairs. However, our current implementation does not handle collisions well. In the context of LockedIn, we want to make sure that user information can never be lost or overwritten.
Collisions happen when two different keys have the same index after applying the key_to_index function. To handle collisions, we can use a technique called linear probing.
Linear probing works by finding the next available slot after the collision index and placing the new key*value pair there.
Complete the insert and get methods.