function to delete element in binary tree
def deletion ( root , key ) : NEW_LINE INDENT if root == None : NEW_LINE INDENT return None NEW_LINE DEDENT if root . left == None and root . right == None : NEW_LINE INDENT if root . key == key : NEW_LINE INDENT return None NEW_LINE DEDENT else : NEW_LINE INDENT return root NEW_LINE DEDENT DEDENT key_node = None NEW_LINE q = [ ] NEW_LINE q . append ( root ) NEW_LINE DEDENT