

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Hash Functions
incomplete
2: Hash Collisions
incomplete
3: Hashmaps
incomplete
4: Deterministic
incomplete
5: One Way
incomplete
6: Toy Hash Function
incomplete
7: Toy Hash Review
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Maps in Go, object literals in JavaScript, dictionaries in Python, and hashes in Ruby are all examples of hashmaps. Hashmaps are a data structure that uses a hash function under the hood to map keys to values.
The hash function used by a map in Go takes the key as an input and hashes it to an address in memory. The value associated with that key is then stored in the memory address.
We can create an empty map by using the make function. Maps in Go must be initialized before they can be used.
// create a map called "ages" with string keys and int values
ages := make(map[string]int)
There is a bug in the code, fix it.