Question: 4. The given programming code shown in figure 3 is written to perform the binary tree insert function. By using the following code, answer the

 4. The given programming code shown in figure 3 is written

4. The given programming code shown in figure 3 is written to perform the binary tree "insert" function. By using the following code, answer the following question: a) Transfer the graph below into data flow annotations. [8 marks] b) Is the graph represent the correct flow of the software? If no, please redraw the correct graph and justify your answers. [8 marks] 1.4 5-7 1 void btree::insert(tnode*&ptr,int item) 2 { 3 if (ptr==NULL) 4 { 5 ptr=new tnode; 6 if(ptr==NULL) 7 { 8 coutright=NULL; ptr->left=NULL; 1 ptr-Sitem=item; 8-10 11.16 17 -06-o-rece 1 } else 18-20 1 1 { if (itemitem) insert (ptr->left item); else insert(ptr->right item); } 21-22 1 23-24 1 } 1 The source code

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!