a guest Jan 18th, 2019 53 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. while getLeftNode(breedNode) OR getRightNode(breedNode):
  6.     for i in range(0, length(name):
  7.         if ascii(i) < ascii(getBreed(breedNode)[i]):
  8.             breedNode = getLeftNode(breedNode)
  9.         elif ascii(i) > ascii(getBreed(breedNode)[i]):
  10.             breedNode = getRightNode(breedNode)
  11. if getBreed(breedNode) = name:
  12.     print(name, "is in the tree")
  13. else:
  14.     print(name, "is not 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