The value of open hashing and closed hashing

Open hash (separate chain):

In open hashing, keys are stored in linked lists attached to hash table cells.

Closed Hashing (Open Addressing):

In private hashing, all keys are stored in the hash table itself without the use of linked lists.

I cannot understand why they are called open, closed and separate. Can someone explain this?

+87
hash
Feb 03 2018-12-12T00:
source share
3 answers

The use of “closed” and “open” reflects whether we are really locked in using a certain position or data structure (this is a very vague description, but hopefully the rest helps).

For example, "open" in "open addressing" tells us that the index (aka address) in which the object will be stored in the hash table is not completely determined by its hash code. Instead, the index may change depending on what is already in the hash table.

“Closed” in “closed hash” refers to the fact that we never leave the hash table; each object is stored directly in the index in the internal hash table array. Please note that this is only possible using any open addressing strategy. This explains why "private hashing" and "public addressing" are synonymous.

Contrast this with open hashing — in this strategy, none of the objects are actually stored in a hash table array; instead of being hashed, the object is stored in a list that is separate from the internal hash table array. "open" means the freedom we gain by leaving a hash table and using a separate list. By the way, the “separate list” tells why open hashing is also known as the “separate chain”.

In short, “closed” always refers to some kind of strict guarantee, for example, when we guarantee that objects are always stored directly in a hash table (closed hashing). Then the opposite is “closed” “open”, therefore, if you do not have such guarantees, the strategy is considered “open”.

+112
Feb 03 '12 at 6:24
source share

The name open addressing refers to the fact that the location ("address") of an element is not determined by its hash value. (This method is also called closed-loop hashing.)

In a separate chain, each bucket is independent and has a kind of ADT (list, binary search trees, etc.) records with the same index. In a good hash table, each bucket has zero or one record, because we need operations of order O (1) to insert, search, etc.

This is an example of a separate chain using C ++ with a simple hash function using the mod operator (obviously a bad hash function)

+1
Jun 08 '17 at 12:20
source share

Ok, it's so easy to understand the hashing concept of Open And Close,

In Open hashing, it takes a link list property, which refers if any index key allready has a data element, than we can insert another data element in the same place, it is obvious that it is open for data having the same location after he is already busy with another.

And in Close, if the data gets a location in the table, than no data can use this address.

Solved ........ simple na

-10
Jun 15 '16 at 7:36
source share



All Articles