View difference between Paste ID: iT16cNdY and 5EShYp5d
SHOW: | | - or go back to the newest paste.
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()
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")