Please see attached file

1 answer below »
Please see attached file
Answered Same DayNov 18, 2021

Answer To: Please see attached file

Ria answered on Nov 29 2021
152 Votes
#include
#include
#include
struct item_node_struct
{
char name[32];
int count;
struct item_node_struct* left, * ri
ght;
};
typedef struct item_node_struct item_node;
struct tree_name_node_struct
{
char treeName[32];
struct tree_name_node_struct* left, * right;
item_node* theTree;
};
typedef struct tree_name_node_struct tree_name_node;
// tree insertion
tree_name_node* insert_tree_node(tree_name_node* root, char* s_tree)
{
static int node_count = 0;
tree_name_node* newnode = (tree_name_node*)malloc(sizeof(tree_name_node));
if (newnode) {
strcpy(newnode->treeName, s_tree);
newnode->left = NULL;
newnode->right = NULL;
newnode->theTree = NULL;
}
if (root == NULL) {
root = newnode;
node_count++;
return root;
}
if (node_count == 1) {
root->left = newnode;
node_count++;
return root;
}
else if (node_count == 2) {
root->left->right = newnode;
node_count++;
return root;
}
else if (node_count == 3) {
root->right = newnode;
node_count++;
return root;
}
}
// item creation
item_node* create_item_node(char* s_item, int c_item)
{
    item_node* newnode = (item_node*)malloc(sizeof(item_node));
if (newnode) {
strcpy(newnode->name, s_item);
newnode->count = c_item;
newnode->left = NULL;
newnode->right = NULL;
}
return newnode;
}
// item insertion (node)
item_node* insert_item_node(item_node* node, char* s_item, int...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here