void main()
{

AVL *root;
int ch,data;
initAVL(&root);

while(1)
{

printf("\nMENU \n1.CREATE NODE \n2.DISPLAY \n3.EXIT \nENTER YOUR CHOICE : ");
scanf("%d",&ch);
	switch(ch)
	{
		case 1 :
			printf("\n ENTER DATA FOR THE NODE : ");
			scanf("%d",&data);
	
			if(insert(&root,data))
				displayAVL(root);	
			else
				printf("\n ERROR ");
			break;
		case 2 :
			displayAVL(root);
			break;
		case 3 :
			exit(1);
		default :
				printf("\nWRONG CHOICE");

	}
}
}
Exemple #2
0
struct AVLTree *newAVLTree(){
   struct AVLTree *tree;

   tree = (struct AVLTree *)malloc(sizeof(struct AVLTree));
   assert(tree != 0);

   initAVL(tree);
   return tree;

}