Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

show the binary search tr Color the vertices of the following graph so that no v

ID: 3696626 • Letter: S

Question

show the binary search tr Color the vertices of the following graph so that no vertices of the same color share an edge. Use as few colors as possible and explain why the graph cannot be coloured using fewer colors. Be specific. 3. Show the binary search tree that results from inserting the sequence of letters (ignoring case) of your first and last names, excluding duplicates (i.e. for'Freddy' the second 'd' would not be inserted into the tree as that would be a duplicate.) 4. Let A={3,4, 5} and B={4, 5,6,7}, and suppose the universal set is U={ 1, 2, 3.....9}. List all of the elements in the following sets: a. (A B)' b. (A B) times A c. (AB) 5. How many integers in the set {n Z|1lessthanorequaltonlessthanorequalto900} are divisible by 2, 6, or 9? (Be careful, the "divisible" by 2 and 6 isn't 12...)

Explanation / Answer

#include<stdio.h>
#include<stdlib.h>

typedef struct BST
{
char data;
struct BST *left;
struct BST *right;
}node;

node *create(char);
void insert(node *,node *);
void preorder(node *);

int main()
{
char ch,name[25],i=0;
node *root=NULL,*temp;
gets(name);
while(name[i]!='')
{
   temp=create(name[i]);
   if(root==NULL)
   root=temp;
   else
   insert(root,temp);
   i++;

}
  
printf("nPreorder Traversal: ");
preorder(root);
return 0;
}

node *create(char a)
{
node *temp;

temp=(node*)malloc(sizeof(node));
temp->data=a;
temp->left=temp->right=NULL;
return temp;
}

void insert(node *root,node *temp)
{
if(temp->data<root->data)
{
if(root->left!=NULL)
insert(root->left,temp);
else
root->left=temp;
}
  
if(temp->data>root->data)
{
if(root->right!=NULL)
insert(root->right,temp);
else
root->right=temp;
}
}

void preorder(node *root)
{
if(root!=NULL)
{
   preorder(root->left);
   printf("%c ",root->data);
preorder(root->right);
}
}