Skip to main content

Posts

Showing posts from October 9, 2017

BINARY SEARCH TREE USING LINK LIST WITH CREATION,INSERTION & TRAVERSAL PRE-ORDER,IN-ORDER,POST-ORDER

DOWNLOAD PROGRAM CODING: #include<stdio.h> #include<conio.h> struct node { int data; struct node *left; struct node *right; }; struct node *tree=NULL; struct node *insert(struct node *,int); void preorder(struct node *); void inorder(struct node *); void postorder(struct node *); void main() { int ch,data; clrscr(); do {  printf("\n    ___MAIN MENU___");  printf("\n1.INSERTION");  printf("\n2.TRAVERSAL PRE-ORDER");  printf("\n3.TRAVERSAL IN-ORDER ");  printf("\n4.TRAVERSAL POST-ORDER");  printf("\n5.EXIT");  printf("\nENTER THE NUMBER:");  scanf("%d",&ch);  switch(ch)   {   case 1:   printf("ENTER THE DATA:");   scanf("%d",&data);   tree=insert(tree,data);   break;   case 2:   preorder(tree);   break;   case 3:   inorder(tree);   break;   case 4:   postorder(tree);   break;   case 5:   printf("PRESS ENTER FOR EXIT..