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()
- while getLeftNode(breedNode) OR getRightNode(breedNode):
- for i in range(0, length(name):
- if ascii(i) < ascii(getBreed(breedNode)[i]):
- breedNode = getLeftNode(breedNode)
- elif ascii(i) > ascii(getBreed(breedNode)[i]):
- breedNode = getRightNode(breedNode)
- if getBreed(breedNode) = name:
- print(name, "is in the tree")
- else:
- print(name, "is not in the tree")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement