CS130-lecture-20201116

IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE

C goes to the next open value because they collide

IMAGE IMAGE IMAGE IMAGE

IMAGE

resize is called if the table is >= being half full.

IMAGE

The first 8 insertions before the resize:

IMAGE

Put the existing keys (they rehash), then continue putting the rest of the list

IMAGE IMAGE

IMAGE

A is true B is false C is true (another case of A basically) D is false (another case of B)

IMAGE

For get: best case runtime is O(1), worst case is O(n). For resize: avg runtime is O(m). For put: amortized O(1) runtime.

IMAGE

Load factor must be < 1 otherwise it will infinitely loop thru the table on a search miss.

IMAGE

We can’t simply set a key to null to delete, becauses if there are keys that hash to that index we won’t be able to find it. We start by setting the first key to null, then we have to rehash and reput the keys in the same cluster.

IMAGE