Hash Table
Collisions
Clustering
Hash Functions
Often consists of 2 things
5 things make a good hash function
Load Factor
Hashing
Folding Method
Steps
Hashing
Multiplication Method
h(k) = floor[m(kA mod 1)]
Hashing
Strings
Steps
Open Addressing
Linear Probing
h(x) + c
Quadratic Probing
i(k) + c1p+ c2p2
Separate Chaining
Hash Table
Complexity
Complexity
Time
Average/Amortized: O(1) ♦ Worst: O(n)
Space
O(1)
*Worst case delete/search from looping through elements that hash to same value, worst case insert from rehashing operation (reallocating array)