Binary tree
Binary tree
#include <stdio.h>
#include <conio.h>
#include <malloc.h>
struct node
{
struct node *left;
int data;
struct node *right;
};
void main()
{
void insert(struct node **,int);
void inorder(struct node *);
void postorder(struct node *);
void preorder(struct node *);
ptr = NULL;
ptr->data=NULL;
clrscr();
for(i=0;i<no;i++)
{
printf("Enter the item\n");
scanf("%d",&num);
insert(&ptr,num);
}
//getch();
printf("\nINORDER TRAVERSAL\n");
inorder(ptr);
printf("\nPREORDER TRAVERSAL\n");
preorder(ptr);
printf("\nPOSTORDER TRAVERSAL\n");
postorder(ptr);
getch();
}