24
Hashing with Buckets

Hashing with Buckets. read 1 6+4 = 10

Embed Size (px)

Citation preview

Page 1: Hashing with Buckets. read 1 6+4 = 10

Hashing with Buckets

Page 2: Hashing with Buckets. read 1 6+4 = 10
Page 3: Hashing with Buckets. read 1 6+4 = 10
Page 4: Hashing with Buckets. read 1 6+4 = 10
Page 5: Hashing with Buckets. read 1 6+4 = 10
Page 6: Hashing with Buckets. read 1 6+4 = 10
Page 7: Hashing with Buckets. read 1 6+4 = 10
Page 8: Hashing with Buckets. read 1 6+4 = 10

read

Page 9: Hashing with Buckets. read 1 6+4 = 10
Page 10: Hashing with Buckets. read 1 6+4 = 10

1

Page 11: Hashing with Buckets. read 1 6+4 = 10

6+4 = 10

Page 12: Hashing with Buckets. read 1 6+4 = 10
Page 13: Hashing with Buckets. read 1 6+4 = 10

2

Page 14: Hashing with Buckets. read 1 6+4 = 10
Page 15: Hashing with Buckets. read 1 6+4 = 10

Cluster 1: Adams Coles Flint

Cluster 2: Bates Dean

Page 16: Hashing with Buckets. read 1 6+4 = 10

The problem is that the home address of dean, which is the head of a cluster, is not free

(20)Adams (20)Coles (22)Dean (20)Flint

Two clusters

Overlapped

Page 17: Hashing with Buckets. read 1 6+4 = 10

25

-1

-1

22

23

-1

Page 18: Hashing with Buckets. read 1 6+4 = 10

Solution

Page 19: Hashing with Buckets. read 1 6+4 = 10

3

Page 20: Hashing with Buckets. read 1 6+4 = 10

b >=1, may be more than one slot in

bucket

Page 21: Hashing with Buckets. read 1 6+4 = 10

4

Actual Addresses .See next slide

Applicable to variable

length records

Page 22: Hashing with Buckets. read 1 6+4 = 10
Page 23: Hashing with Buckets. read 1 6+4 = 10

Patterns of records access

Page 24: Hashing with Buckets. read 1 6+4 = 10

Summary : Hashing technique

• Progressive overflow• Other techniques

1. Double hashing2. Chained progressive overflow3. Chaining with a separate overflow area4. Scatter tables

Buckets