Advertisement
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
- name = input("Enter the name of a breed")
- breedNode = tree.root()
- rootNode = tree.root()
- for node in tree:
- if breedNode.getBreed() = name:
- print(name, "is in the tree.")
- else:
- breedNode = breedNode.getLeftNode()
- if breedNode = null:
- breedNode = rootNode.getRightNode()
- if breedNode = null:
- print(name, "is not in the tree.")
- if breedNode.getBreed() = name:
- print(name, "is in the tree.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement