# Suppose a health insurance company identifies each member with a 7-digit account number. Define...

## Question:

Suppose a health insurance company identifies each member with a 7-digit account number. Define the hashing function h which takes the first 3 digits of an account number as 1 number and the last 4 digits as another number; adds them, and then applies the mod-41 function. How many linked lists does this create?

Compute h(4686158)

Compute h(9813284)

## Hashing Function:

Hashing functions are used to calculate the location of the item to be stored in the hash table. There are numerous different hashing functions; however, mod m is the most popular one where m is the size of the hash table.

Since mod 41 is used, it tells us that the size of the hash table would be 41. Even if it has a larger size, we can't utilize locations greater than 40 since we will still be taking mod 41 at the end. Assuming open hashing is used, there must be linked lists at each of 41 locations on the hash table since the total number of accounts we will be storing is presumably much larger than 41.

#### Compute h(4686158):

Number of the first 3 digits: 468

Number of the last 4 digits: 6158

{eq}6158 + 468 = 6626 \\ 6626\ mod\ 41 = 25 {/eq}

#### Compute h(9813284):

Number of the first 3 digits: 981

Number of the last 4 digits: 3284

{eq}3284 + 981 = 4265 \\ 4265\ mod\ 41 = 1 {/eq}

For these two accounts, since there is no collision of the keys, there are no linked lists yet.