What is an operator function? Describe the function of an operator function?
1241
#include
#include
#include
#include
void insert(struct btreenode **, int);
void inorder(struct btreenode *);
struct btreenode
{
struct btreenode *leftchild;
struct btreenode *rightchild;
int data;
};
main()
{
struct btreenode *bt;
bt=(struct btreenode *)NULL;
int req,i=1,num;
clrscr();
printf("Enter number of nodes");
scanf("%d",&req);
while(i<=req)
{
printf("Enter element");
scanf("%d",&num);
insert(&bt,num);
i++;
}
inorder(bt);
}
void insert(struct btreenode **sr, int num)
{
if(*sr==NULL)
{
*sr=(struct btreenode *)malloc (sizeof(struct btreenode));
(*sr)->leftchild=(struct btreenode *)NULL;
(*sr)->rightchild=(struct btreenode *)NULL;
(*sr)->data=num;
return;
}
else
{
if(num < (*sr)->data)
insert(&(*sr)->leftchild,num);
else
insert(&(*sr)->rightchild,num);
}
return;
}
void inorder(struct btreenode *sr)
{
if(sr!=(struct btreenode *)NULL)
{
inorder(sr->leftchild);
printf("\n %d",sr->data);
inorder(sr->rightchild);
}
else
return;
}
please Modify the given program and add two methods for post
order and pre order traversals.
3830
How to Create new app from templet?
217
How do I turn off iis in windows 10?
964
Why annotations are used in spring?
457
How do I combine data from multiple rows into one in excel?
708
What is a txt file used for?
972
What is routerlink?
880
What are the sap xi components?
5
What does the elements mean in syntax given for url in html?
1186
Can we change Dynamic to Static or Persistent cache? If so
what happens?
2257
List the materials used for manufacturing pcb
1026
What are examples of techno fossils?
1144
How many cores do I need for sql server 2016?
954
Where is cmd located?
1014