We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d0ebbf9 commit 7868536Copy full SHA for 7868536
chapter07/07-HashCollisionLinearProbing.js
@@ -46,10 +46,10 @@ function HashLinearProbing(){
46
return table[position].value;
47
} else {
48
var index = ++position;
49
- while (table[index] === undefined || table[index].key !== key){
+ while (table[index] !== undefined && (table[index] && table[index].key !== key)){
50
index++;
51
}
52
- if (table[index].key === key) {
+ if (table[index] && table[index].key === key) {
53
return table[index].value;
54
55
@@ -82,4 +82,4 @@ function HashLinearProbing(){
82
83
84
};
85
-}
+}
0 commit comments