You are on page 1of 1

Help for AVLTREE 1.01 class (C++) ================================= Deepak 26-June-2002 http://www.geocities.

com/acmesofties/ The class implements the AVL tree. The best among balanced binary trees. The implementation is of an AVL tree with integers in them. Front End of class avltree -------------------------Member variables: node *root; /*Hols the root pointer to the tree*/ Member functions: void insert(int key); /*To insert key to the AVL tree*/ node *getinordersuccessor(node *t); /*To get the inorder successor of a node with non-null right pointer*/ void remove(int key); /* To remove the node with value key*/ int height(node *t); /*returns the height of the subtree with t as root*/ int balance(node *t); /*height(t->right)-height(t->left)*/ node *getparent(int key); /*returns the parent of the node with value key*/ void rightrotate(node *t); /*rightrotates the subtree rooted at t*/ void leftrotate(node *t); /*leftrotates the subtree rooted at t*/ node *getnode(int key); /*returns the node with data=key*/ void inorder(node *t); /*Traverses the tree rooted at t in inorder*/ void preorder(node *t); /*Traverses the tree rooted at t in preorder*/ void postorder(node *t); /*Traverses the tree rooted at t in postorder*/ The nodes in the tree are objects of class node Usage of rightrotate() and leftrotate() can disturb the AVL structure of the tree. They have been included in the front end only any future upgradations Back End of class avltree ------------------------Why do you worry about if everything works right?? /*************************************************************************/

You might also like