#ifndef AVL_H_ #include #define AVL_H_ /* * A node has a value, as well as a left and right child */ struct _Node { uint32_t value; struct _Node* leftChild; struct _Node* rightChild; struct _Node* parent; int height; }; typedef struct _Node* Node; void printTree(Node root); /* * Returns the size of the tree */ uint32_t treeSize(Node n); /* * Create a new node */ Node makeNode(uint32_t num); /* * Insertion of an element into a tree */ int insert(uint32_t num, Node newNode, Node* root); int height(Node root); int heightHelper(Node n); /* * balancing the tree */ void balance(Node* root, Node n, Node child); void balance2(Node* root, Node n); inline int max(int x, int y); inline int min(int x, int y); /* * Locating an element in a tree */ int get(uint32_t num, Node root); /* * Removing an element from a tree */ int removeNode(uint32_t num, Node* root); #endif /* AVL_H_ */