我的代码无法正常工作。请告诉我,我做错了什么?谢谢您的关注!
def Count(self):
def counter(Root):
if self.Root is None:
return 0
else:
return 1 + counter(Root.LeftChild) + counter(Root.RightChild)
counter(self.Root)
答案 0 :(得分:0)
用根替换自我。根
def Count(self):
def counter(Root):
if Root is None:
return 0
else:
return 1 + counter(Root.LeftChild) + counter(Root.RightChild)
counter(self.Root)