Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.
For the best experience please use the latest Chrome, Safari or Firefox browser.
Hash tables
... the background of their implementations.
Samo Penič
Sometimes also called associative array or dictionary. It is a data structure used to map key into values
data["Yoda"] gives us all the information stored for Yoda.
It is widely used to build things such us dictionaries, telephone books, book indexes, ...
Hash table provide Insertion, Deletion and Retreival in constant time!
The memory is accessible by addressing the data numerically.
e.g.: Accessing the item at memory location data[0] yields name of the person Yoda and person's phone number: (01)123-1234
Finding phone number of Darth requires linear search through the array, which is not efficient.
... is performed by so called hash functions. It can be as simple as sum(ascii_code[i]) % array_size
Let's try it out for our phone directory (array_size=13):
They will occur. The probability depends on Load factor (LF=number_of_items/array_size)
We can cope with collisions in multitude of ways:
data[0] data[1] data[2] data[3] data[4] data[5] data[6] data[7] data[8] data[9] data[10] data[11] data[12] data[13] |
Use a spacebar or arrow keys to navigate.
Press 'P' to launch speaker console.