What is HashTable Linear Probing ?
**
List Of Operations Available
All methods will same as the single linked list . we will only overwrite method.
.
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 :
Methods
Complexity
Last updated
Was this helpful?