1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #ifndef __AVL_H__
#define __AVL_H__
typedef struct _BSTNode {
int value;
struct _BSTNode* left;
struct _BSTNode* right;
int height;
} BSTNode;
int get_height(BSTNode const* root);
int get_height_without_using_field(BSTNode* root);
int get_balance_score(BSTNode const* root);
void rotate_counterclockwise(BSTNode** a_root);
void rotate_clockwise(BSTNode** a_root);
void balance_after_insert_in_left(int value, BSTNode** a_root);
void balance_after_insert_in_right(int value, BSTNode** a_root);
void insert(int value, BSTNode** a_root);
void free_tree(BSTNode** a_root);
void print_bst_nodes(BSTNode const* root);
void print_bst(BSTNode const* root, char const* label);
void update_height(BSTNode* root);
bool is_every_node_in_tree_avl_balanced(BSTNode const* root);
#endif /* end of include guard: __AVL_H__ */
|
© Copyright 2023 Alexander J. Quinn This content is protected and may not be shared, uploaded, or distributed.