Jump to content

Talk:Extendible hashing

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 212.5.16.228 (talk) at 16:42, 1 July 2010 (Sample Code). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconComputing Unassessed
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
???This article has not yet received a rating on Wikipedia's content assessment scale.
???This article has not yet received a rating on the project's importance scale.

Implementations

I just found that gdbm implements this algorithm. Might be of interest for students. --phil (talk) 20:51, 26 June 2009 (UTC)[reply]

Ronald Fagin has his own page here on Wikipedia, how to link it? I ? Unicode (talk) 12:40, 10 September 2009 (UTC)[reply]

Sample Code

I think i found a bug in the implementation: What happens if during a split the items of the bucket can't be redistributed (i.e. all items stay in one bucket) because one additional bit is not enough to distinguish between the hashvalues of the key.

Example

I try to add subsequently keys whose hashvalues are (I use the most significant bits). The capacity of my buckets are 1.

100
110

in the beginning everything is empty

gd=0        
[---] ---> [---] d=0

Adding 100

gd=0       
[---] ---> [100]        d=0

Adding 110

[---] ---> [100] + 110  d=0  bucket is full => initiate split
                                               result of split: [100] d=1 [---] d=1

split according to most significant bit => *boom* all key-values stay in one bucket

the right thing to do would be doubling the directory more than once

or more algorithmically speaking: double size of directory until at least one value of the bucket to split is moved into the new bucket

situation after *one* split and *one* doubling of directory

gd=1
[0--] --- > [---]       d=1
[1--] --- > [100] + 110 d=1 

=> double directory and split *again*   result of split [100] d=2 [110] d=2

gd=2
[00-] ---> [---] d=1
[01-] -------^
[10-] ---> [100] d=2
[11-] ---> [110] d=2

212.5.16.228 (talk) 16:38, 1 July 2010 (UTC)[reply]