What is a Hash Table?

Data stucture that stores elements in key-value pairs where

Untitled

Untitled

For fast data store and retrieval

Actions and their time complexity

insert ⇒ O(1)

lookup (finding a value based on a key) ⇒ O(1)

delete ⇒ O(1)

search (check if certain key exists) ⇒ O(1)

Hash functions (해시 함수)

A hash function is used for mapping each element of a dataset to indexes in the table. The function generates a value of fixed length for each input that it gets. There are many types of hash functions (ie. md5, SHA-1, SHA-256, etc.) and we can assume that the hash functions in our programming languages use a type that has a time complexity of O(1).

A hash function for a hash table will generate a hash output, which is then used as an index in the hash table and an index space (or an address space) is alloted for that index.

Some key aspects of hash functions: