Question: Code analysis. Need help analyzing code C++. Thanks struct node f int data; struct node left; struct node right; L1i E struct node* NewNode (int

Code analysis. Need help analyzing code C++. Thanks

Code analysis. Need help analyzing code C++. Thanks struct node f intdata; struct node left; struct node right; L1i E struct node* NewNode(int data) f new(struct node);?//-"new" is like -malloc" struct node* node =

node->data = data; node->left NULL; node-right # NULL; return(node); Estatic int lookup

struct node f int data; struct node left; struct node right; L1i E struct node* NewNode (int data) f new(struct node);?//-"new" is like -malloc" struct node* node = node->data = data; node->left NULL; node-right # NULL; return(node); Estatic int lookup (struct node* node, int target) { // 1. Base case empty tree // in that case, the target is not found so return false if (nodeNULL) return(false); else // 2. see if found here if (target else node->data) return (true); // 3. otherwise recur down the correct subtree if (target data) return(lookup (node->left, target)); else return (lookup (node-right, target)) struct node* insert(struct node* node, int data) { // 1. If the tree is empty, return a new, single node if (node == NULL) return(NewNode (data)); else // 2. Otherwise, recur down the tree if (data data) node-left insert(node->left, data); else node->right insert (node->right, data); return(node); / return the (unchanged) node pointer

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!