#ifndef SPLAY_H_ #include #define SPLAY_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; }; 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); void splay(uint32_t num, Node* root); Node moveToRightTree(Node rightTree, Node n); Node moveToLeftTree(Node leftTree, Node n); Node reassemble(Node x, Node leftTree, Node rightTree); /* * Locating an element in a tree */ int get(uint32_t num, Node* root); #endif /* SPLAY_H_ */