Move tree height to a class

This commit is contained in:
Donne Martin
2016-08-14 08:29:25 -04:00
parent b4ed90e649
commit 9176ffe214
4 changed files with 42 additions and 56 deletions

View File

@@ -4,13 +4,13 @@ from nose.tools import assert_equal
class TestHeight(object):
def test_height(self):
root = Node(5)
assert_equal(height(root), 1)
insert(root, 2)
insert(root, 8)
insert(root, 1)
insert(root, 3)
assert_equal(height(root), 3)
bst = BstHeight(Node(5))
assert_equal(bst.height(bst.root), 1)
bst.insert(2)
bst.insert(8)
bst.insert(1)
bst.insert(3)
assert_equal(bst.height(bst.root), 3)
print('Success: test_height')