return hashed value for a key * function: ID of hash function according to which key has to hashed * key: item to be hashed */
| 30 | key has to hashed |
| 31 | * key: item to be hashed */ |
| 32 | int hash(int function, int key) |
| 33 | { |
| 34 | switch (function) |
| 35 | { |
| 36 | case 1: return key%MAXN; |
| 37 | case 2: return (key/MAXN)%MAXN; |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | /* function to place a key in one of its possible positions |
| 42 | * tableID: table in which key has to be placed, also equal |