def main(): root = Node(0) root.set_right(10) root.right.set_right(20) root.right.set_left(5) root.set_left(-10) print get_common_ancestor(root.right.right, root.right.left)
def main(): root = Node(0) root.set_left(-10) root.set_right(10) root.left.set_right(-5) print next_node(root.left, root.left) root = Node(0) root.set_left(-10) root.left.set_right(-5) root.left.right.set_left(-7) print next_node(root.left, root.left)
def main(): root = Node(1) root.set_left(1) root.left.set_left(2) root.left.set_right(1) root.set_right(2) root.right.set_left(1) root.right.set_right(1) root.right.left.set_left(2) count = [0] count_all_sums(root, count, 2) print count
def main(): root = Node(0) root.set_left(-10) root.set_right(10) order = [] pre_order(root, order) big_root = Node(100) big_root.set_right(0) big_root.right.set_left(-10) big_root.right.set_right(10) print contains_subtree(big_root, order)