1 / 18

Insert using Linear Hashing

4. 7. Insert using Linear Hashing. H level (n) = level+1 bits of n. Level = 0, next =. h0 0 1. initial. Insert 2, h 0 (2) = 0. 4 2. 7. Insert using Linear Hashing. H level (n) = level+1 bits of n. Level = 0, next =. h0 0 1. Insert 8, h 0 (8) = 0. 4 2. 7. 8.

tavia
Download Presentation

Insert using Linear Hashing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 4 7 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 0, next = h0 0 1 initial Insert 2, h0(2) = 0

  2. 4 2 7 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 0, next = h0 0 1 Insert 8, h0(8) = 0

  3. 4 2 7 8 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 0, next = h0 0 1 No room, so insert into an overflow block, which triggers the splitting process.

  4. 4 2 7 8 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 0, next = h1 00 01 10 11 h0 0 1 No room, so insert into an overflow block, which triggers the splitting process. H1(4) = 00 H1(2) = 10 H1(8) = 00

  5. 4 8 7 2 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 0, next = h1 00 10 h0 0 1 Denotes split bucket No room, so insert into an overflow block, which triggers the splitting process. H1(4) = 00 H1(2) = 10 H1(8) = 00

  6. 4 8 7 2 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 0, next = h1 00 10 h0 0 1 Advance NEXT by one. Insert 5, h0(5) = 1

  7. 4 8 7 5 2 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 0, next = h1 00 10 h0 0 1 Insert 3, h0(3) = 1

  8. 4 8 7 5 2 3 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 0, next = h1 00 10 h0 0 1 No room, insert into overflow and trigger a split.

  9. 4 8 5 2 3 7 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 0, next = h1 00 01 10 11 h0 0 1 Redistribute 3, 5, 7 using H1 H1(3) = 11 H1(5) = 01 H1(7) = 11

  10. 4 8 5 2 3 7 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 0, next = h1 00 01 10 11 h0 0 1 Advance Next, but it is at the bottom of the current Level.

  11. 4 8 5 2 3 7 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 1, next = h1 00 01 10 11 h0 0 1 So reset it to the top and increment Level to 1.

  12. 4 8 5 2 3 7 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 1, next = h1 00 01 10 11 Remove split indicators and only use H1

  13. 4 8 5 2 3 7 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 1, next = h1 00 01 10 11 Insert 15, h1(15) = 11

  14. 4 8 5 2 3 7 15 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 1, next = h1 00 01 10 11 No room, so insert into an overflow block, which triggers the splitting process.

  15. 4 8 5 2 3 7 15 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 1, next = h1 00 01 10 11 Split Next using level+1 H function H2(4) = 100 H2(8) = 000

  16. 8 5 2 3 7 15 4 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 1, next = h1 00 01 10 11 Split Next using level+1 H function H2(4) = 100 H2(8) = 000 h2 100

  17. 8 5 2 3 7 15 4 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 1, next = h1 00 01 10 11 Mark bucket as split Advance Next. h2 100

  18. 8 5 2 3 7 15 4 Insert using Linear Hashing H level (n) = level+1 bits of n Level = 1, next = h1 00 01 10 11 Mark bucket as split Advance Next. h2 100 And Insert and Insert and Insert ….

More Related