Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def Count(self):
- if not self.Root:
- return 0
- tree = self.Root
- counter = 1
- def find(tree, counter):
- for node in tree.Children:
- counter += 1
- if node.Children:
- return find(node, counter) # this place
- return counter
- count = find(tree, counter)
- return count
- def Count(self):
- if not self.Root:
- return 0
- tree = self.Root
- counter = [1]
- def find(tree, counter):
- for node in tree.Children:
- counter[0] += 1
- print(node.NodeValue)
- if node.Children:
- find(node, counter)
- return counter
- count = find(tree, counter)
- return count[0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement