forked from CCallahanIV/data-structures
-
Notifications
You must be signed in to change notification settings - Fork 1
Hash table #6
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
Open
chamberi
wants to merge
87
commits into
master
Choose a base branch
from
hash-table
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Hash table #6
Changes from all commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
1d1a5e9
Initial build out of node and bst structures.
CCallahanIV 6f6a938
Added bst and test_bst files.
chamberi 565e132
bst and test_bst files.
chamberi 98c5039
commiting initial insert tests.
0ecf7b2
added insert method.
chamberi c174663
Merge branch 'bst' of https://github.com/chamberi/data-structures int…
chamberi 597732f
commit to pull remote changes.
8f5b2ac
Merge branch 'bst' of https://github.com/chamberi/data-structures int…
5c46d3b
refactor of insert and tests.
chamberi 71ec1a7
merge conflict resolution.
c5587dc
fixed initial tests and insert function, new test for size.
chamberi 994d3cb
commit to pull remote changes.
a2afe95
commiting implementation of depth, balance, and tests.
afecfc5
else to handle if node with value already exists on insert.
f407dc3
edited docstrings.
c86b4f2
bst class can take an iter, built test fixture to fill bst.
chamberi 584ed8e
added in_order function, refactor one test.
chamberi 97c1573
recursive function.
23f848f
in order traversal and test.
aba9fa0
tests
chamberi ce9921e
tests.
chamberi 0117406
pre order traversal, beginning post order traversal.
df85d06
Refactored post-order traverse.
chamberi dde70ae
commit to pull post_order trav.
a56c6bd
Merge branch 'traversal-bst' of https://github.com/chamberi/data-stru…
f7f2aba
trying again, post order.
chamberi ba81221
added one space.
f2a0d81
breadth first traversal.
a8ed646
beggining implementation of delete node function.
1800d6d
finished, for now, delete function.
chamberi 6a06c45
initial refactor of delete.
899878f
Merge branch 'delete-bst' of https://github.com/chamberi/data-structu…
110c919
added edge case catches for self.root holding value to delete.
8bab894
delete bug fix for parent of del node del node on right.
0e37d23
fixed bug in find_min_parent helper function of delete.
515d19e
root removal root right has left min node has right.
204e0dd
refactored contains function to cooperate with delete.
d4e9f19
fixed delete node with multiple children bug.
9f0337e
removed import pdb; pdb.set_trace() line in _find_min_parent.
02c79de
more tests for delete.
chamberi 02834a4
Merge branch 'delete-bst' of https://github.com/chamberi/data-structu…
chamberi 5052593
added tests, merged new delete code.
chamberi 9abbf12
debug to past big_bst end delete tests. edited tests to check that ne…
b5a49ac
edited test file, added tests.
12ac5df
added pre order and post order tests.
6daedec
commented out timeit section.
ab0ed10
new file, balanced bst. modified private functions to be marked as pr…
ad1219b
testing for balance function in some different cases.
e9a806b
removed corpse code from bst.py. added parent and red properties to b…
db28edf
edited docstrings.
9afc1a5
removed redundant assignment in delete del_node =
a63a1d2
fixtures for l, r, lr, rl, l/r/lr/rl with gc moves.
chamberi 658f4db
added parent attribute to nodes.
6c3ad01
small test changes.
chamberi 837ca61
merging to get tests.
b097c52
fixed initial tests.
chamberi d651ea8
Meng changes to test file. rge branch 'balance-bst' of https://github…
84d1df5
fixing tests.
chamberi c31ac8b
setting up rebalance function to pass initial tests.
e3af0b2
Meng initial tests. rge branch 'balance-bst' of https://github.com/ch…
6a9d41a
adding more tests.
chamberi a49b26a
added balance check for balance tree, see if tree is unbalanced.
a21719e
added 1-14 sequential insert for balancing tests.
chamberi 9bc5031
tests from 14 down to 1 added for balance bst.
chamberi be53c29
implementation of left and right rotations.
a5fa20e
Meng tests for left rotations.rge branch 'balance-bst' of https://git…
85bd424
beginning implementation of _left_right and _right_left rotations.
9e2b4d1
fixed all but one test.
chamberi 8e0d76d
Merge branch 'balance-bst' of https://github.com/chamberi/data-struct…
6093456
tests for left_right rotations.
1bd5746
tests for right left rotations.
1005e73
left-right and right-left various functions.
chamberi 41acf82
Merge branch 'balance-bst' of https://github.com/chamberi/data-struct…
chamberi 7e3535f
Meng down implementsations of left right and right left rotations.rge…
9c43013
added file for hash_table.py
329d538
initial implementation of hashtable. created test file.
3bdc95a
edited description.
df2b945
list comprehensions, check for existing key.
1ce911a
added travis yml file for data structures.
chamberi d437c4f
tests for hashtable using words file. added colin ben hash. cleaned u…
ee0c62f
Merge branch 'hash-table' of https://github.com/chamberi/data-structu…
chamberi 14cf4b7
added readme and deleted corpse code.
chamberi ac7749d
added coverage and info to readme.
chamberi 340da88
Update README.MD
chamberi 498dc35
Update README.MD
chamberi 71b4f4d
removed pdb.
65c5045
Merge branch 'hash-table' of https://github.com/chamberi/data-structu…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| language: python | ||
| python: | ||
| - "2.7" | ||
| - "3.5" | ||
|
|
||
|
|
||
| # command to install dependencies | ||
| install: | ||
| - pip install -e .[test] | ||
| # - pip install coveralls | ||
|
|
||
| # command to run tests | ||
| script: | ||
| - py.test --cov=. --cover-report term-missing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,35 @@ | ||
| [](https://travis-ci.org/CCallahanIV/data-structures) | ||
| #Summary | ||
|
|
||
| The assignment was to implement a [Weighted Graph](https://codefellows.github.io/sea-python-401d5/assignments/graph_3_weighted.html) | ||
| in Python containing the following methods: | ||
| The HashTable is a data structure that implements an | ||
| assosiative array. The structure maps keys to values | ||
| in such a way that values may be accessed in O(1) time. | ||
| This is done through use of a hashing function. | ||
| The hashing function maps the content of the key to | ||
| a specific bucket. As the content of the key always | ||
| maps to a specific hash value, the key's value may | ||
| be accessed quickly. | ||
|
|
||
|
|
||
| * g.nodes(): return a list of all nodes in the graph | ||
| * g.edges(): return a list of all edges in the graph | ||
| * g.add_node(n): adds a new node 'n' to the graph | ||
| * g.add_edge(n1, n2): adds a new edge to the graph connecting 'n1' and 'n2', if either n1 or n2 are not already present in the graph, they should be added. | ||
| * g.del_node(n): deletes the node 'n' from the graph, raises an error if no such node exists | ||
| * g.del_edge(n1, n2): deletes the edge connecting 'n1' and 'n2' from the graph, raises an error if no such edge exists | ||
| * g.has_node(n): True if node 'n' is contained in the graph, False if not. | ||
| * g.neighbors(n): returns the list of all nodes connected to 'n' by edges, raises an error if n is not in g | ||
| * g.adjacent(n1, n2): returns True if there is an edge connecting n1 and n2, False if not, raises an error if either of the supplied nodes are not in g | ||
| * g.depth_first_traversal(start): Returns the path list for the entire graph with a depth first traversal. | ||
| * g.breadth_first_travers(start): Returns the path list for the entire graph with a breadth first traversal. | ||
| - get(key) - should return the value stored with the given key | ||
| - set(key, val) - should store the given val using the given key | ||
| - _hash(key) - should hash the key provided (note that this is an internal api) | ||
|
|
||
|
|
||
| # Coverage: | ||
|
|
||
| ----------------------------------------------------------- | ||
| ---------- coverage: platform darwin, python 2.7.12-final-0 ---------- | ||
| Name Stmts Miss Cover Missing | ||
| ----------------------------------------------------------- | ||
| src/hash_table.py 47 2 96% 54, 58 | ||
| ----------------------------------------------------------- | ||
| ---------- coverage: platform darwin, python 3.5.2-final-0 ----------- | ||
|
|
||
|
|
||
| | Name | Stmts | Miss | Cover | | ||
| | ----------------------- | ----- | ---- | ----- | | ||
| | weighted_graph.py | 78 | 3 | 96% | | ||
| | test_weighted_graph.py | 178 | 0 | 100% | | ||
| | ----------------------- | --- | -- | ---- | | ||
| | TOTAL | 256 | 3 | 98% | | ||
|
|
||
|
|
||
| Name Stmts Miss Cover Missing | ||
| ----------------------------------------------------------- | ||
| src/hash_table.py 47 2 96% 54, 58 | ||
| ----------------------------------------------------------- | ||
|
|
||
| Gen Primes function used: | ||
| Sieve of Eratosthenes | ||
| Code by David Eppstein, UC Irvine, 28 Feb 2002 | ||
| http://code.activestate.com/recipes/117119/ | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thorough documentation. Nice.