Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Question 2 (20 points): Purpose: To do some deeper reflection on primitive binary trees. Degree of Difficulty: Moderate We say that two binary trees...

Python 3!!!Binary Trees!!!

Below:There is Treenode Adt

  • Attachment 1
  • Attachment 2
  • Attachment 3
Question 2 (20 points):Purpose: To do some deeper reflection on primitive binary trees.Degree of Difficulty: ModerateWe say that two binary trees ti and te satisfy the mirror property if all of the following conditions are true:1. The data value stored in the root of ti is equal to the data value stored in the root of t2.2. The left subtree of ti and the right subtree of t2 satisfy the mirror property.3. The right subtree of ti and the left subtree of to satisfy the mirror property.If both ti and te are empty, we say the mirror property is satisfied, but if one is empty but the other is not.the mirror property is not satisfied.Using the TreeNode ADT found on the assignment page:Write a function mirrored(t1, t2) that returns True if the two given trees satisfy the mirror property.and False otherwise.Design and implement a recursive function called reflect (tnode) that swaps every left and rightsubtree in the given primitive tree. This function returns None, but modifies the given tree.Design and implement a recursive function called reflection ( tnode) that creates a copy of the giventree, with left and right subtrees swapped. In other words, the returned tree has to satisfy the mirroredproperty with the original tree, but the original tree cannot be affected at all.Explain why mirrored (atree, reflect (atree) ) returns False, whereas mirrored (atree, reflection (atree))returns True.
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question