Mon. Sep 26th, 2022

Physics homework help. Python 3!!!Binary Trees!!! Below:There is Treenode AdtAttachment 1Attachment 2Attachment 3Question 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.

Don't use plagiarized sources. Get Your Custom Essay on
Physics homework help
Just from $13/Page
Order Essay

By ravi

Leave a Reply

Your email address will not be published.