Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
1d1a5e9
Initial build out of node and bst structures.
CCallahanIV Jan 16, 2017
6f6a938
Added bst and test_bst files.
chamberi Jan 16, 2017
565e132
bst and test_bst files.
chamberi Jan 16, 2017
98c5039
commiting initial insert tests.
Jan 16, 2017
0ecf7b2
added insert method.
chamberi Jan 16, 2017
c174663
Merge branch 'bst' of https://github.com/chamberi/data-structures int…
chamberi Jan 16, 2017
597732f
commit to pull remote changes.
Jan 16, 2017
8f5b2ac
Merge branch 'bst' of https://github.com/chamberi/data-structures int…
Jan 16, 2017
5c46d3b
refactor of insert and tests.
chamberi Jan 16, 2017
71ec1a7
merge conflict resolution.
Jan 16, 2017
c5587dc
fixed initial tests and insert function, new test for size.
chamberi Jan 17, 2017
994d3cb
commit to pull remote changes.
Jan 17, 2017
a2afe95
commiting implementation of depth, balance, and tests.
Jan 17, 2017
afecfc5
else to handle if node with value already exists on insert.
Jan 17, 2017
f407dc3
edited docstrings.
Jan 17, 2017
c86b4f2
bst class can take an iter, built test fixture to fill bst.
chamberi Jan 17, 2017
584ed8e
added in_order function, refactor one test.
chamberi Jan 18, 2017
97c1573
recursive function.
Jan 18, 2017
23f848f
in order traversal and test.
Jan 18, 2017
aba9fa0
tests
chamberi Jan 18, 2017
ce9921e
tests.
chamberi Jan 18, 2017
0117406
pre order traversal, beginning post order traversal.
Jan 18, 2017
df85d06
Refactored post-order traverse.
chamberi Jan 18, 2017
dde70ae
commit to pull post_order trav.
Jan 18, 2017
a56c6bd
Merge branch 'traversal-bst' of https://github.com/chamberi/data-stru…
Jan 18, 2017
f7f2aba
trying again, post order.
chamberi Jan 18, 2017
ba81221
added one space.
Jan 18, 2017
f2a0d81
breadth first traversal.
Jan 18, 2017
a8ed646
beggining implementation of delete node function.
Jan 19, 2017
1800d6d
finished, for now, delete function.
chamberi Jan 19, 2017
6a06c45
initial refactor of delete.
Jan 19, 2017
899878f
Merge branch 'delete-bst' of https://github.com/chamberi/data-structu…
Jan 19, 2017
110c919
added edge case catches for self.root holding value to delete.
Jan 19, 2017
8bab894
delete bug fix for parent of del node del node on right.
Jan 19, 2017
0e37d23
fixed bug in find_min_parent helper function of delete.
Jan 19, 2017
515d19e
root removal root right has left min node has right.
Jan 19, 2017
204e0dd
refactored contains function to cooperate with delete.
Jan 19, 2017
d4e9f19
fixed delete node with multiple children bug.
Jan 20, 2017
9f0337e
removed import pdb; pdb.set_trace() line in _find_min_parent.
Jan 20, 2017
02c79de
more tests for delete.
chamberi Jan 20, 2017
02834a4
Merge branch 'delete-bst' of https://github.com/chamberi/data-structu…
chamberi Jan 20, 2017
5052593
added tests, merged new delete code.
chamberi Jan 20, 2017
9abbf12
debug to past big_bst end delete tests. edited tests to check that ne…
Jan 22, 2017
b5a49ac
edited test file, added tests.
Jan 22, 2017
12ac5df
added pre order and post order tests.
Jan 22, 2017
6daedec
commented out timeit section.
Jan 22, 2017
ab0ed10
new file, balanced bst. modified private functions to be marked as pr…
Jan 22, 2017
ad1219b
testing for balance function in some different cases.
Jan 22, 2017
e9a806b
removed corpse code from bst.py. added parent and red properties to b…
Jan 23, 2017
db28edf
edited docstrings.
Jan 23, 2017
9afc1a5
removed redundant assignment in delete del_node =
Jan 23, 2017
a63a1d2
fixtures for l, r, lr, rl, l/r/lr/rl with gc moves.
chamberi Jan 23, 2017
658f4db
added parent attribute to nodes.
Jan 23, 2017
6c3ad01
small test changes.
chamberi Jan 23, 2017
837ca61
merging to get tests.
Jan 23, 2017
b097c52
fixed initial tests.
chamberi Jan 23, 2017
d651ea8
Meng changes to test file. rge branch 'balance-bst' of https://github…
Jan 23, 2017
84d1df5
fixing tests.
chamberi Jan 23, 2017
c31ac8b
setting up rebalance function to pass initial tests.
Jan 23, 2017
e3af0b2
Meng initial tests. rge branch 'balance-bst' of https://github.com/ch…
Jan 23, 2017
6a9d41a
adding more tests.
chamberi Jan 23, 2017
a49b26a
added balance check for balance tree, see if tree is unbalanced.
Jan 24, 2017
a21719e
added 1-14 sequential insert for balancing tests.
chamberi Jan 24, 2017
9bc5031
tests from 14 down to 1 added for balance bst.
chamberi Jan 24, 2017
be53c29
implementation of left and right rotations.
Jan 24, 2017
a5fa20e
Meng tests for left rotations.rge branch 'balance-bst' of https://git…
Jan 24, 2017
85bd424
beginning implementation of _left_right and _right_left rotations.
Jan 24, 2017
9e2b4d1
fixed all but one test.
chamberi Jan 24, 2017
8e0d76d
Merge branch 'balance-bst' of https://github.com/chamberi/data-struct…
Jan 24, 2017
6093456
tests for left_right rotations.
Jan 24, 2017
1bd5746
tests for right left rotations.
Jan 24, 2017
1005e73
left-right and right-left various functions.
chamberi Jan 24, 2017
41acf82
Merge branch 'balance-bst' of https://github.com/chamberi/data-struct…
chamberi Jan 24, 2017
7e3535f
Meng down implementsations of left right and right left rotations.rge…
Jan 24, 2017
0be96a0
trying to fix.
chamberi Jan 24, 2017
9c43013
added file for hash_table.py
Jan 24, 2017
329d538
initial implementation of hashtable. created test file.
Jan 24, 2017
8cbd2b0
fixed left-right and right-left.
chamberi Jan 24, 2017
ada1a7b
Meng left-right and right-left rotations.rge branch 'balance-bst' of …
Jan 24, 2017
4227245
added more double rotation tests.
chamberi Jan 24, 2017
e77f9ee
fixed test for right left rotation.
Jan 24, 2017
3bdc95a
edited description.
Jan 24, 2017
df2b945
list comprehensions, check for existing key.
Jan 25, 2017
728cd6e
halfway thru refactoring to work for 3 nodes on delete.
chamberi Jan 25, 2017
1ce911a
added travis yml file for data structures.
chamberi Jan 26, 2017
d437c4f
tests for hashtable using words file. added colin ben hash. cleaned u…
Jan 26, 2017
ee0c62f
Merge branch 'hash-table' of https://github.com/chamberi/data-structu…
chamberi Jan 26, 2017
14cf4b7
added readme and deleted corpse code.
chamberi Jan 26, 2017
ac7749d
added coverage and info to readme.
chamberi Jan 26, 2017
e89d48e
started the docstrings.
chamberi Jan 26, 2017
a154a1d
fix for deletion of root child.
Jan 26, 2017
e8d30bb
trie functions, untested.
Jan 26, 2017
06dd0f7
resolving merge conflict.
Jan 26, 2017
e5542e3
debugging trie.
Jan 26, 2017
f2931d9
debugged remove method.
Jan 26, 2017
f77e8e1
decremented size, added doc strings.
chamberi Jan 26, 2017
561ee4d
changed travis yml file to stop email notications.
chamberi Jan 26, 2017
7f8f6e4
credentials.
Jan 26, 2017
a2acc3b
Merge branch 'trie' of https://github.com/chamberi/data-structures in…
Jan 26, 2017
599feb0
beginning implementation of traversal of trie.
Jan 26, 2017
10574d5
start of the trie traversal.
chamberi Jan 27, 2017
8d207e7
tests for trie_trav with parameters and fixtures.
Jan 27, 2017
df6443c
Merge branch 'trie-traversal' of https://github.com/chamberi/data-str…
Jan 27, 2017
da15f5e
while loop in traversal.
Jan 27, 2017
565fc66
recursive traversal method for trie.
Jan 27, 2017
c2c6332
full traversal, not specific to start.
Jan 29, 2017
7fd8075
tests for trie and commented out portions of traversal in trie trav.
Jan 29, 2017
010774b
trie traversal
Jan 30, 2017
66bb5df
generator yields all items after the first instance of the start word.
Jan 30, 2017
cb5556a
updated insert and remove functions from the trie branch, and removed…
chamberi Jan 30, 2017
dcdd86d
fixed indentation on insert and remove.
chamberi Jan 30, 2017
52ab442
added travis.
chamberi Jan 31, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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

# notifications
notifications:
email: false
34 changes: 7 additions & 27 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
[![Build Status](https://travis-ci.org/CCallahanIV/data-structures.svg?branch=master)](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:


* 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.


# Coverage:

---------- 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% |
insert(self, string): will insert the input string into the trie. If character in the input string is already present, it will be ignored.
contains(self, string): will return True if the string is in the trie, False if not.
size(self): will return the total number of words contained within the trie. 0 if empty.
remove(self, string): will remove the given string from the trie. If the word does not exist, will raise an appropriate exception.
traversal(self, start=None): a generator yielding values in the tree in depth-first order.



Loading