Slideshow:
|
|
|
|
Idea:
|
Suffix-1( x ) = x − 2i where i = ⌊ log2( n ) ⌋
= the value after removing the leading 1 bit from
the binary representation
|
What is the Suffix-1( ) function:
x (bin) | i = ⌊ log2( n ) ⌋ | 2i | x - 2i(Suffix(x))
-----------+----------------------+------+----------
2 ( 10) | ⌊ log2( 2) ⌋ = 1 | 2 | 0 ( 0)
3 ( 11) | ⌊ log2( 3) ⌋ = 1 | 2 | 1 ( 1)
4 ( 100) | ⌊ log2( 4) ⌋ = 2 | 4 | 0 ( 00)
5 ( 101) | ⌊ log2( 5) ⌋ = 2 | 4 | 1 ( 01)
6 ( 110) | ⌊ log2( 6) ⌋ = 2 | 4 | 2 ( 10)
7 ( 111) | ⌊ log2( 7) ⌋ = 2 | 4 | 3 ( 11)
8 (1000) | ⌊ log2( 8) ⌋ = 3 | 8 | 0 ( 000)
9 (1001) | ⌊ log2( 9) ⌋ = 3 | 8 | 1 ( 001)
10 (1010) | ⌊ log2(10) ⌋ = 3 | 8 | 2 ( 010)
11 (1011) | ⌊ log2(11) ⌋ = 3 | 8 | 3 ( 011)
12 (1100) | ⌊ log2(12) ⌋ = 3 | 8 | 4 ( 100)
13 (1101) | ⌊ log2(13) ⌋ = 3 | 8 | 5 ( 101)
14 (1110) | ⌊ log2(14) ⌋ = 3 | 8 | 6 ( 110)
15 (1111) | ⌊ log2(15) ⌋ = 3 | 8 | 7 ( 111)
|
Conclussion:
Suffix-1(x) returns the suffix of x after removing the leading 1 bit from x
Suffix-1( 10 ) = 0
Suffix-1( 11 ) = 1
Suffix-1( 100 ) = 00
Suffix-1( 101 ) = 01
Suffix-1( 110 ) = 10
Suffix-1( 111 ) = 11
Suffix-1( 1000 ) = 000
Suffix-1( 1001 ) = 001
Suffix-1( 1010 ) = 010
Suffix-1( 1011 ) = 011
...
|
|
|
|
We can locate the search key in the hash index using the Suffix-1( ) function as follows:
|
Note:
|
|
|