Skip to content

Conversation

@breyana
Copy link
Owner

@breyana breyana commented Mar 28, 2017

No description provided.

Copy link

@FrankieFabuloso FrankieFabuloso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! Left some comments.


put(key, value) {
let hashedKey = this.hash(key)
this.list[hashedKey] = new Node(key, value)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you at trying to implement your hashtable with collision chaining?
I think you might be missing the logic in doing so.
Personally, I think that you don't need to do it since you have already implemented a LinkedList and presumably know how it works so I think just knowing that you would use a LinkedList to handle collisions would suffice for the sake of completing all the other more difficult data structures.

But if you wanna handle collision chaining I would defs be able to talk through it with you, it has been a while since I've done it.

if (!this.list[hashedKey]) {
return false
}
return this.list[hashedKey].key === key ? true : false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just return this.list[hashedKey].key === key

@breyana breyana merged commit ae0c96d into master Mar 31, 2017
breyana added a commit that referenced this pull request Mar 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants