Question: Assignment In the provided example code ( lab 1 0 . py ) , a sample binary tree has been provided. Implement the incomplete functions:
Assignment
In the provided example code
labpy a sample binary tree has been provided. Implement the incomplete functions:
traversePreOrder method should print the values of the given binary tree nodes according to preorder traversal strategy
trim method should decrease the values of every node of the tree by
trimleaves method should decrease the values of every LEAF node by
mirror method should swap the left and right subtrees
Note: Only complete the #TODO items of the given code. If your implementation is correct, The output of the program should be similar to:
Original tree:
After trimming entire tree:
After trimming the leaves:
After switching branch values:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
