What is the advantage of using open addressing over chaining when implementing a Hash Table?

Charangan Vasantharajan
2 min readJan 8, 2020

There are two types of data structures used to store data differently.

  1. Direct access table — The size of an array depends on the size of index values.
  2. Hash table — The size of an array does not depend on the size of index values.

What is a Hash Table?

A hash table is an unordered data structure to store data uniformly across an array. It maps keys with their corresponding values, where each key has a unique index. It supports insert, search and delete operations with worst-case time complexity of O(1). We can take it out of these data from the array easily if we know the index of the data which we are going to take out. In addition to this, the overflow situation does not occur in hash tables.

What is Collision?

A hash table uses a hash function (normally hash functions are defined by division method, multiplication method, and universal hashing method) to determine hash code (Index) of any input record in a hash table.

While assigning, a hash function computes the same index value for more than one key. It is called hash collisions. Such collisions always handled mainly by two types of collision handling methods.

1. Separate Chaining using linked list (Open hashing)

2. Open addressing (Closed hashing)

1. Linear probing

2. Quadratic probing

3. Double hashing

4. Last-Come-First-Served hashing

5. Cuckoo hashing

Chaining using linked list vs Open Addressing

What is the advantage of using open addressing over chaining when implementing a Hash Table?

Chaining

Chaining is easy to implement effectively.

Easily delete a value from the table.

It uses less memory if the record is large compared to the open addressing.

Difficult to serialize data from the table.

Open Addressing

Open Addressing needs more computation to avoid clustering (better hash functions only).

Once the table becomes full, hash functions fail to terminate

Less memory requires for small record size.

Since open addressing do not use pointers, it can be easier to serialize

--

--

Charangan Vasantharajan

MASc @ McMaster University | Former Research Intern @ NTU, Singapore