lec17a - Overflow Handling An overflow occurs when the home...

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

View Full Document Right Arrow Icon
Overflow Handling An overflow occurs when the home bucket for a new pair (key, element) is full. We may handle overflows by: ± Search the hash table in some systematic fashion for a bucket that is not full. Linear probing (linear open addressing). Quadratic probing. Random probing. ± Eliminate overflows by permitting each bucket to keep a list of all pairs for which it is the home bucket. Array linear list. Chain.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Linear Probing – Get And Put divisor = b (number of buckets) = 17 . Home bucket = key % 17 . 0481 2 1 6 61 2 2 9 34 28 11 23 7 03 3 30 45 Put in pairs whose keys are 6, 12, 34, 29, 28, 11, 23, 7, 0, 33, 30, 45
Background image of page 2
Linear Probing -- Remove 0481 2 1 6 61 2 2 9 34 28 11 23 7 03 3 30 45 remove(0) 2 1 6 2 2 9 34 28 11 23 7 45 33 30 Search cluster for pair (if any) to fill vacated bucket. 2 1 6 2 2 9 34 28 11 23 7 45 33 30
Background image of page 3

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

View Full DocumentRight Arrow Icon
Linear Probing – remove(34) 0481 2 1 6 61 2 2 9 34 28 11 23 7 03 3 30 45 2 1 6 2 2 9 28 11 23 7 3 30 45 Search cluster for pair (if any) to fill vacated bucket.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/18/2012 for the course COP 3530 taught by Professor Davis during the Fall '08 term at University of Florida.

Page1 / 15

lec17a - Overflow Handling An overflow occurs when the home...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online