a guest Jan 18th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //breedNode is an object of type node representing the root of the tree
  3. name = input("Enter the name of a breed")
  4. breedNode = tree.root()
  5. rootNode = tree.root()
  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.")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand