Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. //breedNode is an object of type node representing the root of the tree
  2.  
  3. name = input("Enter the name of a breed")
  4. breedNode = tree.root()
  5. rootNode = tree.root()
  6.  
  7. for node in tree:
  8. if breedNode.getBreed() = name:
  9. print(name, "is in the tree.")
  10. else:
  11. breedNode = breedNode.getLeftNode()
  12. if breedNode = null:
  13. breedNode = rootNode.getRightNode()
  14. if breedNode = null:
  15. print(name, "is not in the tree.")
  16. if breedNode.getBreed() = name:
  17. print(name, "is in the tree.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement