Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: zhenghuahou/javascript-datastructures-algorithms
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: second-edition
Choose a base ref
...
head repository: loiane/javascript-datastructures-algorithms
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: second-edition
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Aug 21, 2017

  1. fixes loiane#23

    loiane committed Aug 21, 2017
    Copy the full SHA
    c44e749 View commit details

Commits on Sep 7, 2017

  1. gitignore

    loiane committed Sep 7, 2017
    Copy the full SHA
    10b24fd View commit details

Commits on Nov 20, 2017

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f065676 View commit details
Showing with 21 additions and 2 deletions.
  1. +3 −1 .gitignore
  2. +1 −1 chapter01/14-ES6ParameterHandling.js
  3. +9 −0 chapter07/07-HashCollisionLinearProbing.js
  4. +8 −0 chapter07/08-UsingHashCollisionLinearProbing.js
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.idea/*
*.log
*.log
node_modules
coverage
2 changes: 1 addition & 1 deletion chapter01/14-ES6ParameterHandling.js
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ function sum2 (x, y, z) {
z = 3;
return x + y + z;
};
console.log(sum2(4,2)); //outpus 10
console.log(sum2(4,2)); //outpus 9

//******* EcmaScript 6: spread operator ('...')
var params = [3, 4, 5];
9 changes: 9 additions & 0 deletions chapter07/07-HashCollisionLinearProbing.js
Original file line number Diff line number Diff line change
@@ -53,6 +53,15 @@ function HashLinearProbing(){
return table[index].value;
}
}
} else { //search for possible deleted value
var index = ++position;
while (table[index] == undefined || index == table.length ||
(table[index] !== undefined && table[index] && table[index].key !== key)){
index++;
}
if (table[index] && table[index].key === key) {
return table[index].value;
}
}
return undefined;
};
8 changes: 8 additions & 0 deletions chapter07/08-UsingHashCollisionLinearProbing.js
Original file line number Diff line number Diff line change
@@ -26,4 +26,12 @@ console.log('**** Remove **** ');

hashLinearProbing.remove('Gandalf');
console.log(hashLinearProbing.get('Gandalf'));
hashLinearProbing.print();

console.log('**** Remove Test 2 **** ');
console.log('Removing Jonathan', hashLinearProbing.remove('Jonathan'));
console.log('**** Print **** ');
hashLinearProbing.print();
console.log('Get Jamie', hashLinearProbing.get('Jamie'));
console.log('**** Print **** ');
hashLinearProbing.print();