Question: RUN THE FOLLOWING CODE CELL to create class bt_node I pass TEST PREPARATION Run the following cells to create the nodes and trees that will

 RUN THE FOLLOWING CODE CELL to create class bt_node I passTEST PREPARATION Run the following cells to create the nodes and treesthat will be used in the test cases further below In [14]:\# Create a bunch of nodes naned ofter upppercase tetters of theEngtish atphabet \# import string for cur_letter in string.ascii_uppercase: \# globals()[cur_letter] =bt_node( cur_letter) In [15]: \# Buitd a tree (Tree \#1) with ModeA as the root \# A. left =B A. right =C B.

RUN THE FOLLOWING CODE CELL to create class bt_node I pass TEST PREPARATION Run the following cells to create the nodes and trees that will be used in the test cases further below In [14]: \# Create a bunch of nodes naned ofter upppercase tetters of the Engtish atphabet \# import string for cur_letter in string.ascii_uppercase: \# globals()[cur_letter] = bt_node( cur_letter) In [15]: \# Buitd a tree (Tree \#1) with Mode A as the root \# A. left =B A. right =C B. left =D D. left =E D. right =F F.right =G G. left =H G.right =I C. left =] c.right =N J. left =K J.right =L K.left=NK.right=0o.right=PP.right=R \# Buitd a second tree (Tree \#2) with Mode s as the root \# S.left =T T.left =U U.left =V V.left =W W.right =X X. right =Y Y.right =Z These two binary trees can be represented pictorially as follows. The depth of the first tree with node A as root is 6 . The depth of the second tree with node 5 as root is 7 . By definition, root nodes are at depth 0 . Question 140 points 25 mins i^ In this question you will implement a Python function that will return a list of all leaf nodes in a given binary tree. - Implement get_leaf_nodes_r( root) that strictly uses recursiong to accomplish this task This function should return an empty list if the provided treeode does not have any children. You are to write this function from scratch. This means your code should contain no import statements! WARNING If you write this function disregarding the strict specifications mentioned above, you will not get any credit for your solution, even if it happens to "work." YOU MUST WRITE YOUR CODE IN THE FOLLOWING CODE CELL In [ ]: In [ ]: TESTS

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!