Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions