diff options
Diffstat (limited to 'include/lib/algo/avl_tree.h')
-rw-r--r-- | include/lib/algo/avl_tree.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/lib/algo/avl_tree.h b/include/lib/algo/avl_tree.h index f77ce5b..4467fd1 100644 --- a/include/lib/algo/avl_tree.h +++ b/include/lib/algo/avl_tree.h @@ -6,19 +6,21 @@ #include <stdlib.h> #include <sys/types.h> +#define AvlHeight_t uint8_t + struct AVLNode { void* data; bool_t (*compare)(void*, void*); struct AVLNode* left; struct AVLNode* right; - uint8_t height; + AvlHeight_t height; }; // Get the height of an AVL node -uint8_t get_height(struct AVLNode* node); +AvlHeight_t get_height(struct AVLNode* node); // Get the Maximum Height between two -uint8_t max_height(uint8_t a, uint8_t b); +AvlHeight_t max_height(AvlHeight_t a, AvlHeight_t b); // Get the balance factor of a node ssize_t get_balance_factor(struct AVLNode* node); |