0% found this document useful (0 votes)
11 views14 pages

Hashing

The document discusses various hashing techniques, including hash functions, collision resolution methods, and the advantages and disadvantages of chaining and open addressing. It also covers specific hashing algorithms and their complexities, along with practical applications of hashing in data structures. Overall, it provides a comprehensive overview of hashing concepts and their implementations.

Uploaded by

Pratik Anand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views14 pages

Hashing

The document discusses various hashing techniques, including hash functions, collision resolution methods, and the advantages and disadvantages of chaining and open addressing. It also covers specific hashing algorithms and their complexities, along with practical applications of hashing in data structures. Overall, it provides a comprehensive overview of hashing concepts and their implementations.

Uploaded by

Pratik Anand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

has

7 hin
nshng mehed depins ond sedrithy
to afforda faaey
udin a hash key

.Hasin9 fhe kMwgu we ov erchuna

Tt Mahmai tal Compuh m vev a ky


he orrl hasing mrtis Jo us has
7
uehm suich zivu vey lA Colliieus

yubin Hhe hashing M Me me nnt


e help Perec has uhm C o n
a di e he worsCae Search ime Comnpkeaty
as he o() (91) b Somi Cases Norft
Cas Seareh TiMe Compkasy is StU olu).

Thellrin hinpd ae used n Hashing


key Space n)
2
Hash foble ov
Hash Bucke(m)
3. Has h unthm
Direc Add sess Table (D»A:T) ,
n
ire cJJy
Mape
be
DAT y
anatial com pufutin
hash toble rith ntanyamnti

ky spac e (n

CLe (0-9)

n m e u t h , kayr i/ b
n akrve jmple
he Y e p e cthve honed.

lreey
ele a n e n t

T fe sa rhi

S4Ti olt)w.Cp R.C


art o 9
Tue dvecA addestabh

Tue nd
ys 99 7 .
Valye uke
an tan

po e e Avaida
Ma mMy
fable we Can maft use
e hash
tre a t Avnd Tuis P l e ar he Con cap
he M
hashun ere

tash fu ctio ( 1 F )

Divisigv Mo lo !
ky,md M
Ha uuiem
M:L0

9999 23792

782

pa e C)
79977
Hastable
B4ht (m)
B y uai ue abru sthm un we Can

tore Valut
huh table

i w wDn to ctort
Possible
PoT&ble be? he p e cve judx al yeny
occupjd ue tasy
CaUed as e Cell i &
Collisi01

hayc are
map pa uto Sqm
Latahiem e u
Calle Celli

To Arrtele to Colli w9 he ariu

Collie sathrsu Tt huiqui art ustd

Hash uuhi

1 Divio Medylo m

The m va Lut w t thsrtt a


Ae uo. idh mosneavay powerd
2 Tha zv J! n

vaus aety Powtrd 2


he M

1hen Hash u h P u 7 ky Ls
m M:2

M: 3 eoo 2 2

ooo mrdi

2) 102 1001r0 102 Med

126 110 126aLd?


M:9 11 2 2

6 86 mra

102 e2 atd 7

12G da

2)Mid squar Meturd

ky286
(ky (st): s197
M:10o0
in ele vilue
0-17) 19-7 216

aehrdi
3 Drz Entya chen

y :0
M:1o
3 1 9923712
Hagh dh4

)folding methed

fol folBrundary
key(2379213 jndea 1key
23 36 23S721

213
Muhd
) fold shiftin
3 11
key 2

12 3 li he k
11 1236SYil
taa tbl

ReJolu8n Techui7 s
Colls bn

p e addreutin
tTRide .

Cha nin
(0ufsidy Lihear Prrjng

Quadrait prbiny

Dubl Hash i
cha)in
M: 1o0-1)
Mrd M
hnsh u cib tk) kay
23, 19, f3
S2, 4S, s1,
ys2S, 92,69,
uinlin
kad li
jnnpliantut y Hah
Hah tabe.
ha'njnj ruajde me
me
Stord
pDl_be

20 ln
Avrantagts amd drsadvanagud chaninn
he dvevfln sihahm dene hki pla
t chaining mefur he hach Jakh priservu
by q kuy values
icks wihony num

to
2. T h ut Ma1.tain ordeving
am kys
Colliy resoluh
aC CO M -
Search 9uickly,
pbished &dy efhcitly
3Tnserhem amod dlahen a quick and srahöru
tokn chavnin. Jelhn Jake plaut he oni
Sami
wy as he olhon a hrde m o snly Liuks

y chaining wd dyhamil Me mory Managtm u

onndhnce b t suhhk in aspliahms


havin Se veva kyvalu vovyiny dnskial
& o shage pa ce requirdo be allocakd
Masinaing ' e n t d bit n chainn
MaiAAvau t9 The chuhnf Tnser
lnserp
d Mehn'ae 9ick
Fovar fask m has'ng.
e Main Drs dvantajt ue
AvullsAihtide e
spate s
4 ny ntide Spae
we art usjny
wiu n ' kys

hlartest

Tme Coalexy

C ol!)

SearCh

wsCase O(n)
Deuheu
Bu ast : 0(!)

wot ade !
0(n)
0pe AHolr ts&i'ny
)LneAY prrbnf: (L'P)
Ath mpds.
M: LO

Hash fomt (hay): ey medm |


LinA prrbin (k a4, i)
-

(h.f(kt4) +i)mrd
J 0 , ,2 7 (m-1)

E 25, 39, 43, 63, 99, 6, , s, 20

S
1P C25,0) - 4o

'

LP (3,o) + 0
20 1 5,0) + 0 3
3
LP (c5,0) 3f0 Co lin
2-5 tP 6s,t) =+ 7
P (29,0) 1+ 0 7
6S 29,:7+1 /0y 10 z 07..se se

LP G, 0) 6 +0 6

o) S+0 9
Lp ,
Pag4 t s l tan)

(r) ekje L-P ( , 2), $+2 /0 yro 0 Ce 1

L-P (s, 3) +3 1110

LPC5, ): 5+0 *5
n u . 7 CsllTO

Cellrs
l-P C5, 2) : S t2

LP , 0) o to o

2 Collr9
L- ,2) * o
t2 2
uadmh prin (0-P)
a:40(0-1)
CRey): huy Mrd M

(4f(k)+ C,
+ + ¢,*i")med
CP Cy,i) = :2
(-), : ,
J: 0,,2 -

ks5, 11, s?,95, 7?,13, 9, 7


P25,0) S+0 +0 =5F

P ( , o) Y+0 +0
P(59,o) + 0+0 9
8 S
P (5,o) t0+0
P (5,t) : Sti*1+1* 2 ol/)
S+If): -

818
)
Hh thk tm) ?+o +0 2 9
P(77, 0) =

PC97,): 2+/*1= 1Cllgr


P(5,o) +0to

rlcollren'tn 9%,o) : t o 40

4-P() S412t |2
+2+ y19/j
oPCY6,) 6+o to-
s3, ,a S7, 62,?0, L0
ecoudy

P C0,o) = 0t0 +oco


0+1#!- 2
, )
2
. , 2) - 0 +2 fy
Ot0t0
P Cu, o)
.P(Go, 4) + 1 # 1 2
p ( , 2) t 2 +4 :

e
Mappe to
tr y s aY has fabl
The
e has4 fubl
Addved

sderAn u n e t P 4 J A N y

Paty
am e
AAgUnY,

neAV

tme sil)

BL3 utmy
l l i d secnday
sS
7hi pbley

dnsA. ashy
pblen
Avt ruis
TO
w

Tne Co Apltui*y
C C )

2Jaaclaju C o()
WC d()

)Delehot BC O t ) na eCm)
Chainin V pey Adre

Chalnin
p n addresing vegures
tmt More Computk.

h e Jahle may become pl


chainin wi Coun alueyd add
j clord hasing
More elemeuds Jo he ha'u.
chacnt pex aute Chainind 0pe addresing ofars betev
nat for£ne k s aL ah e perrmanti n e
sJereusing a nkel f ewtry Hns trs i

h e Memo r Spau be temes A sl Cn be uwsd even


waskd SnceeMe par e h e iut lu no map
hash l e ase uevty wd im
chainin
wsu exra spau t No n kng Jaks plac
Chaininj
links
cnaddruting
(DM)
Doy bl Hashi
M:1 -9
f k ) k mrd M
(m-1) )
hf(k) 1+ (tmed
+ j+ hf Ck) mrd m

(K,) (ht, (k)


. :

EE25, 15, S?, 9r, 19, 18, P, i , Yt


nd re. 7 CelHS
4ucrut
ne. prh
N 0 The Expece4
eeluut
Surth p addA

2The ape c e
n. ptbes Succeu
pM addr u s s n

-
isa lnd Pa dr
AS Nl TecHNidUE
Ke hashing MLAnd hashiny a9ain afey he h r i a l t
f y sage, he has alle becenme pull oY
UVEr occud, n willke lIA aL: fo nd
l for he new k
Tn This sihuabrm, neu hash Jahh crealed.
a
s
Crealed.

ais newhas ale is drkle in J e s n


exs pne.
N , he prevtus tas
hash sCaneol, d
each kay is CalCulahd again a a
uln ase inok
Thest Callaed kay ae hen stoved i t o he
Cread hash b l e .

You might also like