July 2018
Beginner
202 pages
5h 4m
English
The aim here is to develop pseudocode for the search operation in linear probing.
Perform the following steps:
search(key, array)
search(key, array)s = length(array)hashValue = hash(key, s)i = 0while (i < s and array[(hashValue + i) mod s] != null and array[(hashValue + i) mod s].key != key) i = i + 1keyValue = array[(hashValue + i) mod s]if (keyValue != null && keyValue.key == key)
return keyValue.valueelse return null
Read now
Unlock full access