data-structures · intermediate · ~15 min
Implement linear probing with wrap-around.
An open-addressing table uses 0 to mean an empty slot. Implement int find_slot(const int *table, int cap, int start) returning the index of the first empty slot scanning from start and wrapping, or -1 if the table is full.
int find_slot(const int *table, int cap, int start) {
/* TODO */
return -1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.