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

Function cuckoo

Hashtable/cuckoo-hashing.cpp:100–114  ·  view source on GitHub ↗

function for Cuckoo-hashing keys * keys[]: input array of keys * n: size of input array */

Source from the content-addressed store, hash-verified

98* keys[]: input array of keys
99* n: size of input array */
100void cuckoo(int keys[], int n)
101{
102 // initialize hash tables to a dummy value (INT-MIN)
103 // indicating empty position
104 initTable();
105
106 // start with placing every key at its position in
107 // the first hash table according to first hash
108 // function
109 for (int i=0, cnt=0; i<n; i++, cnt=0)
110 place(keys[i], 0, cnt, n);
111
112 //print the final hash tables
113 printTable();
114}
115
116/* driver function */
117int main()

Callers 1

mainFunction · 0.85

Calls 3

initTableFunction · 0.85
placeFunction · 0.85
printTableFunction · 0.85

Tested by

no test coverage detected