I’m printing off the attributes to the master copy code (ex23) we are to memorize, and curious what the TSTreeNode, self.eq is supposed to be… I thought ‘equals’ at first, because there was a low and high, but when I print the tree stuff off, low is None, high is None, and eq leads to the next letter in a string? I’m using this print off method:
Realized I needed to add more sets to see high low in action.
class PrintTSTree(object):
def graphical(self, branch):
if branch != None:
print("branch.key = ", branch.key)
print("branch.eq = ", branch.eq)
print("branch.low = ", branch.low)
print("branch.high = ", branch.high)
print("branch.value = ", branch.value)
if branch.eq != None:
self.graphical(branch.eq)
if branch.high != None:
print(" \n >>>>>>>>>>>>>>>>> greater >>>> \n")
print("branch high = ")
self.graphical(branch.high)
if branch.low != None:
print("\n <<<<<<<<<<<<<<<<< lower <<<<<< \n")
print("branch low = ")
self.graphical(branch.low)
else:
print("<<<< branch end >>>>")