def main(): a = TreeNode(6) a.left = TreeNode(3) a.right = TreeNode(11) a.left.right = TreeNode(4) a.left.right.right = TreeNode(5) print(kthSmallest(a, 2))
def main(): tree = TreeNode(6) tree.left = TreeNode(3) tree.right = TreeNode(12) tree.left.right = TreeNode(4) tree.right.right = TreeNode(14) print(levelOrder(tree))
def main(): a = TreeNode(5) a.left = TreeNode(3) a.left.right = TreeNode(4) a.right = TreeNode(7) a.right.right = TreeNode(12) print(inOrder(a)) print(inOrder2(a)) print(inorder3(a))
def main(): a = TreeNode(6) a.left = TreeNode(4) a.left.right = TreeNode(5) a.left.left = TreeNode(3) print(inorderSuccessor(a, TreeNode(4)))
def main(): a = TreeNode(6) a.left = TreeNode(4) a.left.left = TreeNode(3) a.left.right = TreeNode(5) a.right = TreeNode(7) p = a.left.left q = a.left.right print(LCA(a, p, q).val)
def main(): a = TreeNode(4) a.left = TreeNode(3) a.right = TreeNode(5) print(invertTree(TreeNode(None))) print(invertTree(a).right)
def main(): t = TreeNode(5) t.left = TreeNode(2) t.right = TreeNode(13) x = Solution() print(t.printInOrder(t))