MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / hash

Function hash

Hashtable/cuckoo-hashing.cpp:32–39  ·  view source on GitHub ↗

return hashed value for a key * function: ID of hash function according to which key has to hashed * key: item to be hashed */

Source from the content-addressed store, hash-verified

30 key has to hashed
31* key: item to be hashed */
32int 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

Callers 1

placeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected