### Partitioned Hashing

• The hash function returns the hash value:

• If the key is composite

and some component of the key is not known:

we cannot compute a meaningful hash value at all !!!

• Partitioned Hashing

• Partititioned Hashing:

• The key is a composite:

• Partititioned Hashing uses n hash functions, one function on one component:

• The hash value is the concatenation of the individual hash function values:

• Example:

• Partitioned Hashing can generate a meaningful hash value for incomplete keys:

• A complete example

• Data on people who buy jewelry:

 ``` (age, salary (in \$1,000)) A(25,60) D(45,60) G(50,75) J(50,100) B(50,120) E(70,110) H(85,140) K(30,260) C(25,400) F(45,350) I(50,275) L(60,260) ```

• Example hash functions: (for illustration of partitioned hashing only)

 ``` Age: h1( age ) = age % 2 Salary: h2( salary ) = salary % 4 ```

Some Hash Function values:

 ``` A(25,60) D(45,60) G(50,75) J(50,100) | | | | | | | | V V V V V V V V 100 100 011 000 <---- partitioned hash values B(50,120) E(70,110) H(85,140) K(30,260) C(25,400) F(45,350) I(50,275) L(60,260) ```

• The Partitional Hash index:

Note:

• I write the hash values as:

 ``` 0.00 0.01 0.10 0.11 1.00 1.01 1.10 1.11 ```

so you can see the 2 parts more easily

• In reality, the hash values are as follows:

 ``` 000 001 010 011 100 101 110 111 ```