Internal hashing techniques

December 4, 2026 · Team EasyExamNotes · 2 min read (est.) · 0 comments

Share on WhatsApp

← RGPV CS-502-CBGS DBMS June 2020 solved question paper

RGPV CS-502-CBGS | June 2020 | Q3(a) | 7 marks

Question: Explain in detail about internal hashing, techniques.

Answer

Internal hashing techniques
Internal hashing techniques

Internal hashing is a technique for locating records in an in-memory hash table using a hash function. Given a key k, the function computes an address h(k) within a table of m slots. A good function distributes keys uniformly and is inexpensive to evaluate. Unlike external hashing, internal hashing primarily concerns main-memory slots rather than disk buckets.

Hash functions: The division method uses h(k)=k mod m. The multiplication method uses floor(m × fractional_part(kA)), where 0<A<1. Mid-square and folding methods derive an address from portions of the key. A collision occurs when different keys map to the same address.

Linear probing: On collision, examine (h(k)+i) mod m for i=0,1,… until an empty slot or the key is found. It is simple but may cause primary clustering. With m=7, keys 10, 17 and 24 all hash to slot 3; linear probing places them at slots 3, 4 and 5.

Quadratic probing: Examine (h(k)+c1i+c2i²) mod m. This reduces primary clustering, but the table size and constants must be chosen carefully to ensure sufficient slots are visited.

Double hashing: Use (h1(k)+i h2(k)) mod m, with a nonzero step relatively prime to m. Different keys can follow different probe sequences.

Separate chaining: Each slot points to a collection of records with the same hash address. In the example, slot 3 contains a chain of 10, 17 and 24. Deletion is straightforward compared with open addressing, which may require tombstones to preserve probe paths.

The load factor α=n/m measures occupancy. Expected lookup time is approximately constant under suitable hashing and controlled load, but worst-case time is linear. Hashing is useful for equality search, not ordered traversal or range queries.

← RGPV CS-502-CBGS DBMS June 2020 solved question paper

Discussion

Ask a question, share your thoughts or report an error.

Sign in to participate in the discussion.

Join the discussion