Closed arjunhm closed 1 month ago
Commit: b3767de91784ce93d8f0e84a650c85c393c7fba6
Running gdb, I found the issue in linear_probe
linear_probe
bool linear_probe(Item *items, int size, Item *item, int idx) { int i, c = 0; while (i < size) { idx = idx % size; if (items[idx].key == NULL) { items[idx].key = item->key; items[idx].value = item->value; printf("%d collisions for %s\n", c, item->key); return true; } c++; idx++; i++; } return false; }
i was initialized to a random value instead of 0.
i
Fix: int i=0, c=0;
int i=0, c=0;
Commit: b3767de91784ce93d8f0e84a650c85c393c7fba6
Running gdb, I found the issue in
linear_probe
i
was initialized to a random value instead of 0.