0
3.5kviews
Write a menu-driven C program for the AVL Tree operations.
  • The Create operation creates the AVL Tree.

  • The Insert operation adds the new element to the constructed AVL Tree.

  • The Delete operation deletes the element from the constructed AVL Tree.

  • The Print operation prints the Pre-order and In-order sequence of constructed AVL Tree along with the Balance Factor (BF) for each node in the AVL Tree.

Test the Program for the following scenarios:

1] Construct the AVL Tree for the data = 10 15 9 12 13 79 45 36 22

2] Insert the new element 17 to the constructed AVL Tree.

3] Delete element 45 from the constructed AVL Tree.

4] Delete the Root element 13 from the constructed AVL Tree.

1 Answer
1
75views

Menu-driven Program for the AVL Tree

#include<conio.h>
#include<stdio.h>
#include<stdlib.h>

typedef struct node
{  int data;
   struct node *left,*right;
   int ht;
}node;

  node *insert(node *,int);
  node *Delete(node *,int);
  void  preorder(node *);
  void  inorder(node *);
  int   height( node *);
  node *rotateright(node *);
  node *rotateleft(node *);
  node *RR(node *);
  node *LL(node *);
  node …

Create a free account to keep reading this post.

and 4 others joined a min ago.

Please log in to add an answer.