Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

added Hash Table #160

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

Merged
TheSTL merged 13 commits into master from hash-table
Dec 1, 2019
Merged

added Hash Table #160

TheSTL merged 13 commits into master from hash-table
Dec 1, 2019

Conversation

Copy link
Member

@ashokdey ashokdey commented Nov 29, 2019
edited
Loading

🌮 What's Inside?

Added the most extensively used Data Structure - Hash Tables (aka Hash Map)

API Details:

  • set(key, value): to set the key-value pair
  • get(key): to get the value(s) associated with the given key
  • delete(key): remove the key and the associated values

Note: Passing the same key with different value, overrides the previous value

🏖

Copy link
Member

TheSTL commented Nov 30, 2019

In remove method instead of creating whole new linked list, manipulating the existing one will be a better approach i think because old linked list will remain in memory. @ashokdey

Copy link
Member Author

In remove method instead of creating whole new linked list, manipulating the existing one will be a better approach i think because old linked list will remain in memory. @ashokdey

@TheSTL raise a PR with this branch for the same

Copy link
Member Author

In remove method instead of creating whole new linked list, manipulating the existing one will be a better approach i think because old linked list will remain in memory. @ashokdey

I've updated it but would like to see your approach as well 👍

Copy link
Member

TheSTL commented Nov 30, 2019

@ashokdey get function returns an array. I'm not able to understand why? It should return the value

Copy link
Member Author

ashokdey commented Dec 1, 2019
edited
Loading

@ashokdey get function returns an array. I'm not able to understand why? It should return the value

Because I am not able to finalize either to override a value when the same key is used more than once. For example:

ht.set('hello', 'Hello Hash Table');
ht.set('hello', 'Hello World');

I am willing to go with override

TheSTL reacted with thumbs up emoji

Copy link
Member

@TheSTL TheSTL left a comment

Choose a reason for hiding this comment

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

💯

@TheSTL TheSTL merged commit 094e1ba into master Dec 1, 2019
@ashokdey ashokdey deleted the hash-table branch December 4, 2019 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@TheSTL TheSTL TheSTL approved these changes

Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /