Linear Probing

If the index calculated for an item's key is occupied by another item, we increment the index by a constant step size (usually $1$).

We keep incrementing the index (modulo the table length to allow for table wraparound) until we find an empty position to insert the key.

int index = getIndex(key);
// if table[index] is occupied, then
for(int i = 0; i < M; i++) { 
  index = (getIndex(key) + i) % M; 
  // stop the loop when table[index] is available!
}
// if we get here and haven't insert the key, the table is full! 
Example