a guest Jan 18th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- //breedNode is an object of type node representing the root of the tree
- letters = 'abcdefghijklmnopqrstuvwxyz'
- name = input("Enter the name of a breed")
- breedNode = tree.root()
- while True:
- if name == breedNode.getBreed():
- print(name + " is in the tree.")
- if letters.index(name.lower) < letters.index(breedNode.getBreed.lower):
- breedNode = breedNode.getLeftNode()
- else if letters.index(name.lower) > letters.index(breedNode.getBreed.lower):
- breedNode = breedNode.getRightNode()
- if breedNode == null:
- print(name + " is not in the tree")
RAW Paste Data