Learn practical skills, build real-world projects, and advance your career
Updated 3 years ago
Python Hash Tables, Linear Probing and Dictionaries
Hashing Function:
A hash function is any function that can be used to map data of arbitrary size to fixed-size values. The values returned by a hash function are called hash values, hash codes, digests, or simply hashes. The values are usually used to index a fixed-size table called a hash table. source
Hash Tables:
When the hashes obtained from hash functions somehow used as indices of a list/array then this list is known as hash tables.
Python Dictionaries
Python dictionaries are implemented using hash tables.
We are going to create a Hash Table class which will have methods to following operations:
- Insert: Insert a new key-value pair
- Find: Find the value associated with a key
- Update: Update the value associated with a key
- List: List all the keys stored in the hash table