Question: Need help with this question. IMPORTANT: For this question, you will be defining a function which USES the BinaryTree ADT. Your code can make use
Need help with this question.

IMPORTANT: For this question, you will be defining a function which USES the BinaryTree ADT. Your code can make use of any of the BinaryTree ADT methods: Binary Tree(), get_data(), set_data(), get_left(), set_left(), get_right(), set_right(), insert_left and insert_right(). Define a function named is_symmetric(treel, tree) which takes two binary trees as parameters and returns True if the two trees are symmetric of each other, and False otherwise. For example, consider the following binary trees: 1 1 2 3 1 3 2 The result is True. 2 3 1 2 3 They are not symmetric. The result is False. Note: you can assume that the BinaryTree class is given and the two trees used as parameters are not empty. For example: Test Result True tree_a = Binary Tree (2) tree_a.insert_left(3) tree_a.insert_right(4) tree_b = BinaryTree (2) tree_b.insert_left(4) tree_b.insert_right(3) print(is_symmetric(tree_a, tree_b)) tree_a = BinaryTree(2) tree_a.insert_left(3) tree_a.insert_right(4) tree_b = BinaryTree(2) tree_b.insert_left(3) tree_b.insert_right(3) print(is_symmetric(tree_a, tree_b)) False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
