Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix hash-table-linear-probing file get method #12

Merged
merged 1 commit into from
Sep 5, 2021

Conversation

hefeng6500
Copy link
Contributor

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

not return this.table[position].value,

the correct is return this.table[index].value

@loiane loiane merged commit 520e02f into PacktPublishing:master Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants