Trees
Trees
Q1:
def find_min(root):
#Write your code from here
current = BST.root
return current.val
Q2:
if root.val == k:
return True
return ancestors
def find_ancestors(root,k):
ancestors = []
return find_ancestors_helper(root, k, ancestors)
Q4:
def find_height(root):
# Write your code here
if root is None:
return -1;
left_height = find_height(root.left_child);
right_height = find_height(root.right_child);
if left_height > right_height:
return left_height + 1
else:
return right_height + 1
Q5: