## Hash functions
hash table = hash function + array

there are some requirements for a hash function:
- It needs to be consistent. For example, suppose you put in “apple” and
get back “4”. Every time you put in “apple”, you should get “4” back.
- It should map different words to different numbers. For example, a
hash function is no good if it always returns “1” for any word you put
in. In the best case, every different word should map to a different
number.
```ruby=
book = {}
book['avocado'] = 1.49
book['avocado'] # => 1.49
```
## use case
### DNS resolution

### Preventing duplicate entries

### Using hash tables as a cache


### Recap
To recap, hashes are good for
• Modeling relationships from one thing to another thing
• Filtering out duplicates
• Caching/memorizing data instead of making your server do work
## Collisions



### suppose you work at a grocery store where you only
sell produce that starts with the letter A.

There are two lessons here:
- Your hash function is really important. Your hash function mapped
all the keys to a single slot. Ideally, your hash function would map
keys evenly all over the hash.
- If those linked lists get long, it slows down your hash table a lot. But
they won’t get long if you use a good hash function!
Hash functions are important. A good hash function will give you very
few collisions. So how do you pick a good hash function? That’s coming
up in the next section!
## Performance

### Load factor



### resizing


A good rule of thumb is, resize when your load factor is greater than **0.7**
### A good hash function
