0 | ||

1 | ||

2 | ||

3 | ||

4 | ||

5 | ||

6 | ||

7 | ||

8 | ||

9 | ||

10 | ||

11 | ||

12 | ||

13 | ||

14 | ||

15 | ||

16 | ||

17 | ||

18 | ||

19 |

Key to be hashed (k): | |

Table size (m): | |

Hash Function: | |

Multiplier (A): | |

On collision: | |

c1: | |

c2: | |

The type of hash function can be set to **Division**, where the hash value is the
key mod the table size, or **Multiplication**, where the key is multiplied by
a fixed value (A) and the fractional part of that result is multiplied by the table size.

Collisions can be resolved by **Linear** or **Quadratic** probing or by
**Double Hashing**. In linear probing, the *i*th rehash is obtained by
adding *i* to the original hash value and reducing the result mod the table size.
This can be obtained by choosing quadratic probing, setting c1 to 1 and c2 to 0.
In quadratic probing, c1**i*+c2**i*^{2} is added to the hash function
and the result is reduced mod the table size. In double hashing, *i* times a second
hash function is added to the original hash value before reducing mod the table size.
In this case, the second hash function is 1 + *k* mod (*m*-1), where
*k* is the key and *m* is the table size.