Page 1 of 1

10 points Question 3 : Trees .. You are asked to implement the following recursive function: TNode. addLayer( TNode root

Posted: Sun May 15, 2022 7:58 am
by answerhappygod
10 Points Question 3 Trees You Are Asked To Implement The Following Recursive Function Tnode Addlayer Tnode Root 1
10 Points Question 3 Trees You Are Asked To Implement The Following Recursive Function Tnode Addlayer Tnode Root 1 (71.84 KiB) Viewed 51 times
10 Points Question 3 Trees You Are Asked To Implement The Following Recursive Function Tnode Addlayer Tnode Root 2
10 Points Question 3 Trees You Are Asked To Implement The Following Recursive Function Tnode Addlayer Tnode Root 2 (46.25 KiB) Viewed 51 times
10 points Question 3 : Trees .. You are asked to implement the following recursive function: TNode. addLayer( TNode root, int val ) Here's the definition of T Node struct: //Put val in here for your new TNodes typedef struct TNode { int key: struct TNode •left, right; TNode: This function replaces the NULLA at the bottom of the tree with new tNodes that contain the specified val as their key. Here's an example of what it would do to a given tree: 30 50 70 NULL NULL NULL 60 SULL NUEL NELL 12 NULL NULL before adaLayer root, 42 ) NULL SELENULI. NULL after addLayer root. 42 ) Remember to mora the testade at the bottom of the tree. If your malloc failur function should cafer Ile with institut Bin Sardele BST this function abond return the Nathat the path tolle point to To here the of this cunables the neth EL. ALI SULE SELL Laft Hallas Tab 137 Before advertent. 13372

The only functions you should call are malloc, sizeof, erit, and addLayer. TNode. addLayer( TNode root, int val ) //Declare any local variables you need //Base case: Recursive case be sure to use the return value from the recall