📗 Each element \(x\) is stored at the address (on memory) \(h\left(x\right)\), where \(h\) is the called the hash function.
➩ For example \(h\left(x\right) = x \mod 100\) or \(h\left(x\right) = \left \lfloor{\sin\left(x\right) \cdot 100}\right \rfloor\). (\(\left \lfloor{...}\right \rfloor\) is the floor function).
📗 Collisions (multiple items want to be stored at the same address) can be handled by open addressing (probing) or chaining.
➩ Open addressing: probe the memory to find the next open address.
➩ Chaining: a list of items stored at every address.
📗 Search: \(O\left(1\right)\).
➩ Apply the hash function. If the key is not found, probe or search in the chain.
📗 Notes and code adapted from the course taught by Professors Gurmail Singh, Yiyin Shen, Tyler Caraza-Harter.
📗 If there is an issue with TopHat during the lectures, please submit your answers on paper (include your Wisc ID and answers) or this Google form Link at the end of the lecture.
📗 Anonymous feedback can be submitted to: Form. Non-anonymous feedback and questions can be posted on Piazza: Link