Matrix Hashing With Two Level of Collision Resolution: National Institute of Technology Raipur
Matrix Hashing With Two Level of Collision Resolution: National Institute of Technology Raipur
Matrix Hashing With Two Level of Collision Resolution: National Institute of Technology Raipur
Submitted By:
KOMARAVALLI RAJESH Roll No. : 20116052
2ndSemester
Electronics and Communication Engineering
key into the cell of T where that key i=0, 1...m-1. The initial position is T [h'
should be stored, typically scrambling the (k)]; later position probed is offset by
keys so that keys with similar values are the amount that depend in a quadratic
not placed near each other in the table. A manner on the probe number i.
hash collision occurs when the hash
function maps a key into a cell that is
already occupied by a different key. Double Hashing:
Linear probing is a strategy for resolving
collisions, by placing the new key into the Double Hashing is one of the best
closest following empty cell. techniques available for open addressing
because the permutations produced have
Time Complexity: Worst time to many of the characteristics of randomly
search an element in linear probing is O chosen permutations.Double hashing
(table size). uses a hash function of the form h (k, i)
= (h1(k) + i h2 (k)) mod m Where h1 and
h2 are auxiliary hash functions and m is
This is because-Even if there is only one the size of the hash table. h1 (k) = k mod
element present and all other elements m or h2 (k) = k mod m'. Here m' is
are deleted.Then, “deleted” markers slightly less than m (say m-1 or m-2).
present in the hash table makes search
the entire table.
There are mainly two methods to handle
collision:
Quadratic Probing:Suppose a record R 1) Separate Chaining
with key k has the hash address H (k) = 2) Open Addressing
h then instead of searching the location In this article, only separate chaining is
with addresses h, h+1, and h+ 2...We discussed. We will be discussing Open
linearly search the locations with addressing in the next post.
addresses h, h+1, h+4,
h+9...h+i2Quadratic Probing uses a hash
function of the form h (k,i) = (h' (k) + Separate Chaining:
The idea is to make each cell of hash
table point to a linked list of records that stored in the same table.
have same hash function value. Let us 2) Wastage of Space (Some Parts of
consider a simple hash function as “key hash table are never used)
mod 7” and sequence of keys as 50, 3) If the chain becomes long, then
700, 76, 85, 92, 73, 101. search time can become O(n) in the
worst case.
4) Uses extra space for links.
Performance of Chaining:
Performance of hashing can be
evaluated under the assumption that
each key is equally likely to be hashed
to any slot of table (simple uniform
hashing). m = Number of slots in hash
table n = Number of keys to be inserted
in hash table Load factor α = n/m
Expected time to search = O(1 + α)
Expected time to delete = O(1 + α) Time
to insert = O(1)Time complexity of
search insert and delete is O(1) if α is
O(1)
https://www.google.com/url?sa=i&url=https
%3A%2F%2Fcourses.cs.washington.edu%2Fco
urses%2Fcse326%2F00wi%2Fhandouts%2Flec
ture16%2Fsld015.htm&psig=AOvVaw3FdspBb
_yA97a8ETtU56De&ust=1630058158686000&
source=images&cd=vfe&ved=0CAwQjhxqFwo
TCNiDnZG2zvICFQAAAAAdAAAAABAP
https://www.tutorialspoint.com/difference-
between-data-type-and-data-structure
https://www.includehelp.com/data-structure-
tutorial/collisions-in-hashing-and-collision-
resolution-techniques.aspx