What is HashTable Linear Probing ?
List Of Operations Available
Implementation of HashTable in Javascript :
class HashTable {
constructor() {
this.table = {};
}
}Put
put(key, value) {
if (key != null && value != null) {
const hashKey = this.getHashCode(key);
if (this.table[hashKey] == null) {
this.table[hashKey] = new KeyValue(key, value);
} else {
let position = hashKey + 1;
while (this.table[position] != null) {
position++;
}
this.table[position] = new KeyValue(key, value);
}
return true;
}
return false;
}Remove
Get
VerifyRemoveSideEffect
Conclusion :
Last updated