week5 - HASHING Static Files Expandable Files Still we can...

Info icon This preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
HASHING Static Files Expandable Files Still we can add, Extendible Hashing delete records Linear Hashing Dynamic Hashing 0 Hash Function Key m-1 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.
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
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 0 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 0 N 33 42 2 N 3 46 1 N 19
Image of page 2
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. X=10 T F(successful) = 1 + 5 = 6 T F(unsuccessful) = 1 + 10 = 11 File needs reorganization if we have many records in the overflow area
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
T D
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern