#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.
3230
What are the features discontinued in exchange 2013 when compared with exchange 2007?
516
What is the importance of oop?
600
Where the schedule margin key is customized?
740
What are the android application main components?
460
Are there any css (styles) provided by salesforce.com as part of the supported lightning components ?
176
What is template? Why use? Detail?
447
Explain why cannot we use leds for rectification purpose?
537
Why cross join is used?
618
What is linked list with example?
485
Name three disadvantages of using a linear model?
106
Can I audit just changes done by a couple users?
326
How do you concatenate in sql?
536
How to deleting an existing file in perl programming?
488
Calculate the address of a random element present in a 2d array, given base address as ba.
1053