Question: BST.h code #ifndef BST_h #define BST_h struct Node { long data; Node* left; Node* right; }; void traverse(Node* root){ if (root != NULL){ traverse (root->left);

 BST.h code #ifndef BST_h #define BST_h struct Node { long data;

BST.h code #ifndef BST_h #define BST_h struct Node { long data; Node* left; Node* right; }; void traverse(Node* root){ if (root != NULL){ traverse (root->left); std::cout data right); } } Node* insert(Node* root, long value){ if (root == NULL){ root = new Node; root->data = value; root->left = NULL; root->right = NULL; } else{ if (value data){ root->left = insert(root->left, value); } else{ root->right = insert(root->right, value); } } return root; } bool search (Node* root, long value){ if (root == NULL){ return false; } else{ if (root->data == value){ return true; } else if (value data){ return search(root->left, value); } else { return search(root->right, value); } } } #endif

// // A small library for sampling random numbers from a uniform distribution // #ifndef RandomSupport_h #define RandomSupport_h #include  RandomSupport.h code typedef std::uniform_int_distribution uniform_distribution; typedef std::mt19937 randomizer; randomizer new_randomizer(){ randomizer rng; rng.seed(std::random_device()()); return rng; } uniform_distribution new_distribution(long start, long end){ uniform_distribution dist(start, end); return dist; } long sample(uniform_distribution& dist, randomizer& r){ return dist(r); } #endif /* RandomSupport_h *

My code so far:

#include

#include

struct node{

int key;

struct node*left,*right;

};

struct node*newnode (int item){

struct node*temp=(struct node*)malloc (sizeof(struct node));

temp->key=item;

temp->key=temp->right=NULL;

return temp;

}

void inorder (struct node*rook){

if(root!=NULL){

inorder(root->left);

printf("%",root->key);

inorder (root->right);

}

}

struct node*insert(struct node*node, int key){

if(node==NULL)return newnode(key);

if(keykey)

node->left=insert(node->left,key);

else if (key>node->key)

node->right=insert(node->right,key);

return node;

}

Plz help!

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!