Implementation of Hashing with Chaining in Python

Hashing is a data structure that is used to store a large amount of data, which can be accessed in O(1) time by operations such as search, insert and delete. Various Applications of Hashing are:

  • Indexing in database
  • Cryptography
  • Symbol Tables in Compiler/Interpreter
  • Dictionaries, caches, etc.

Concept of Hashing, Hash Table and Hash Function

Hashing is an important Data Structure which is designed to use a special function called the Hash function which is used to map a given value with a particular key for faster access of elements. The efficiency of mapping depends of the efficiency of the hash function used.

Example:



h(large_value) = large_value % m

Here, h() is the required hash function and ‘m’ is the size of the hash table. For large values, hash functions produce value in a given range.

hashing

How Hash Function Works?