MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / is_sum_tree

Method is_sum_tree

data_structures/binary_tree/is_sum_tree.py:99–106  ·  view source on GitHub ↗

>>> BinaryTree.build_a_tree().is_sum_tree False >>> BinaryTree.build_a_sum_tree().is_sum_tree True

(self)

Source from the content-addressed store, hash-verified

97
98 @property
99 def is_sum_tree(self) -> bool:
100 """
101 >>> BinaryTree.build_a_tree().is_sum_tree
102 False
103 >>> BinaryTree.build_a_sum_tree().is_sum_tree
104 True
105 """
106 return self.root.is_sum_node
107
108 @classmethod
109 def build_a_tree(cls) -> BinaryTree:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected