new version book with the first 2 chapters edited, examples added

This commit is contained in:
Mari Wahl 2015-01-07 17:00:49 -05:00
parent 5161f9d08a
commit fc7949d7e9
3 changed files with 23 additions and 36 deletions

23
src/trees/check_largest_item.py Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env python
__author__ = "bt3"
from binary_search_tree import BST, Node
def largest(node):
if node.right:
return largest(node.right)
return node.item
if __name__ == '__main__':
bst = BST()
l = [10, 5, 6, 3, 8, 2, 1, 11, 9, 4]
for i in l:
bst.add(i)
print(largest(bst.root))