This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: HASHING Static Files Expandable Files Still we can add, Extendible Hashing delete records Linear Hashing Dynamic Hashing Hash Function Key m1 HF = mod(key,m) HF(ki)=HF(kj) ki != kj collision We must find a collision resolution method Prime Data Area Overflow Area A bucket has several blocks. It can store many blocks as long as we have room for a new record collision is no problem. Example: Bkfr=3 (Bucket Factor) HF=mod(key,5) Key values : 35, 71, 33, 19, 22, 60, 42, 46, 47, 17 Key HF=mod(key,5) Collision(N/Y) Prime Overflow Data Area Area 35 60 35 mod (35,5)=0 N 71 mod (71,5)=1 N 71 46 33 3 N 1 19 4 N 17 22 42 47 47 22 2 N 2 60 N 33 42 2 N 3 46 1 N 19 47 2 N 4 17 2 Y To decrease number of collisions keep prime data area size > the number of records to be inserted to the files. N number of records in file LF= M x Bkfr Bucket Factor Load Factor LF= 10= 0,66 %66 5x3 T F =one disk access = s + r + dtt Time needed to read one bucket X: Average overflow chain length T F(successful) = s + r + dtt + (x/2) * (s + r + dtt) T F(unsuccessful) = s + r + dtt + x * (s + r + dtt) Lower load factors means less collision and shorter access time. Large bucket factor also means less overflow....
View Full
Document
 Spring '11
 FazlıCan

Click to edit the document details