# Hash Functions > [!summary] **Summary** > - Used to index large amounts of data > - Utilize key:value pairs > - Address for each key calculated using the key itself > - Collisions resolved with open or closed addressing > - Hashing is widely used in databases indexing, compilers, caching, password authentication, and more > - Insertion, deletion and retreival occur in constant time Hash tables seem to be a solution that drastically reduces the runtime for accessing data values at the cost of memory space (hash space) ## The Load Factor The **load factor** determines when the hash set needs to allocate more space in the memory (aka increase its capacity). $\text{Load Factor} = \frac{\text{Total \# of items stored}}{\text{Size of the array}}$ A lower load factor (i.e. 0.10 or 10%) can cause wasted computational time as the hash set will need to regularly allocate new space and rehash the values. ## Hash Functions An ideal hash function will: - *Deterministic* - *Minimize collisions* - Provide *uniform distribution* of hash values - Be *easy to calculate* - *Resolve* any *collisions* that occur ### Collisions A **collision** can occur if you attempt to add an element at its associated hash value while there is already an element existing at that location within the table.