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

Hashtable fixes #54

Merged
merged 11 commits into from
May 5, 2017
Merged

Hashtable fixes #54

merged 11 commits into from
May 5, 2017

Conversation

orenovadia
Copy link
Contributor

Previously: HashTable was:

  1. Not fully implemented
  2. put method was of O(N) complexity due to this hashval not in keys
  3. put method crashed with NameError

Main issues addressed:

  1. Implementing all the API from the docs
  2. Implementing put with O(1) complexity
  3. Added unit tests
  4. Added ResizableHashTable subclass that grows exponentially in space
  5. PEP8 formatting

Thanks

1. Fixed put method from O(N) due to condition `hashval not in keys` which requires a full scan to O(1) amortized.
2. Added empty and deleted unique objects tpo be used as sentinels.
1. Added unit tests for adding more than one entry with the same hash.
 2. Added unit test to assure `get` halts if key is not found
1. Fixed documentation
2. added __delitem__
Added len() support and testing
…he `put` method

 to grow the table by a factor of 2 each time the table has more than 2/3 of it full (same as __builtin__ dict)
@keon keon merged commit 89f4e49 into keon:master May 5, 2017
@keon
Copy link
Owner

keon commented May 5, 2017

thanks!

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.

2 participants