Closed hefeng6500 closed 3 years ago
Hello!
test demo
const hash = new HashTableLinearProbing(); hash.put('Ygritte', 'ygritte@email.com'); // hashCode: 4 hash.put('Jonathan', 'jonathan@email.com'); // hashCode: 5 hash.put('Jamie', 'jamie@email.com'); // hashCode: 5 console.log(hash.get('Jamie')); // jonathan@email.com
this log should be 'jamie@email.com', but get 'jonathan@email.com'
The Error log reason is this line return this.table[position].value after while loop
return this.table[position].value
while loop
not return this.table[position].value,
the correct is return this.table[index].value
return this.table[index].value
Hello!
test demo
this log should be 'jamie@email.com', but get 'jonathan@email.com'
The Error log reason is this line
return this.table[position].value
afterwhile loop
not
return this.table[position].value
,the correct is
return this.table[index].value