Re: Proposal for a new ghash table



> was 123456. In a table of 4 nodes, the resulting
> hash val is 0. In a table of 32 nodes, the resulting
> hash val is 8. In order to find the correct key for
> a particular node, you'll have to
>     1) compute the current hash value V from the 
>         key K (store it as V1)
>     2) if the node is found, return it.
>     2) if not, find the greater n value defined by
>        2^n < V
>     4) compute the new K value

    Oups... This should be 'the new V value'. K is
    invariant, but since V is (f(K) % size), the value
    of V changes on each iteration...

>     5) go to step 2
> Before returning, a good thing should be to move
> the node to position V1 if V != V1. The next time
> you'll want to access to the node, the look up
> will be faster. 


Yours, 

Emmanuel



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]