/** * Travel subtree for find the value in preorder. */ _avlnode_t* _avl_tree_find_value(const _avl_tree_t* cpt_avl_tree, const _avlnode_t* cpt_root, const void* cpv_value) { bool_t b_result = false; assert(cpt_avl_tree != NULL); assert(cpv_value != NULL); assert(_avl_tree_is_inited(cpt_avl_tree)); if (cpt_root == NULL) { return NULL; } b_result = _GET_AVL_TREE_TYPE_SIZE(cpt_avl_tree); _avl_tree_elem_compare_auxiliary(cpt_avl_tree, cpv_value, cpt_root->_pby_data, &b_result); if (b_result) { return _avl_tree_find_value(cpt_avl_tree, cpt_root->_pt_left, cpv_value); } b_result = _GET_AVL_TREE_TYPE_SIZE(cpt_avl_tree); _avl_tree_elem_compare_auxiliary(cpt_avl_tree, cpt_root->_pby_data, cpv_value, &b_result); if (b_result) { return _avl_tree_find_value(cpt_avl_tree, cpt_root->_pt_right, cpv_value); } else { return (_avlnode_t*)cpt_root; } }
/** * Insert the value into subtree. */ _avl_tree_insert_result_t _avl_tree_insert_avlnode( const _avl_tree_t* cpt_avl_tree, _avlnode_t* pt_root, const void* cpv_value) { _avl_tree_insert_result_t t_insert_result; bool_t b_result = false; assert(cpt_avl_tree != NULL); assert(cpv_value != NULL); assert(_avl_tree_is_inited(cpt_avl_tree)); /* if root is NULL then allocate memory */ if(pt_root == NULL) { pt_root = _alloc_allocate( (_alloc_t*)&cpt_avl_tree->_t_allocator, _AVL_TREE_NODE_SIZE(_GET_AVL_TREE_TYPE_SIZE(cpt_avl_tree)), 1); assert(pt_root != NULL); _avl_tree_init_elem_auxiliary((_avl_tree_t*)cpt_avl_tree, pt_root); pt_root->_pt_left = pt_root->_pt_right = NULL; pt_root->_un_height = 0; t_insert_result._pt_adjust = pt_root; t_insert_result._pt_new = pt_root; b_result = _GET_AVL_TREE_TYPE_SIZE(cpt_avl_tree); _GET_AVL_TREE_TYPE_COPY_FUNCTION(cpt_avl_tree)(pt_root->_pby_data, cpv_value, &b_result); assert(b_result); return t_insert_result; } /* compare the value and current node */ /* if value < current node then insert into left subtree */ b_result = _GET_AVL_TREE_TYPE_SIZE(cpt_avl_tree); _avl_tree_elem_compare_auxiliary(cpt_avl_tree, cpv_value, pt_root->_pby_data, &b_result); if(b_result) { t_insert_result = _avl_tree_insert_avlnode(cpt_avl_tree, pt_root->_pt_left, cpv_value); pt_root->_pt_left = t_insert_result._pt_adjust; pt_root->_pt_left->_pt_parent = pt_root; pt_root = _avl_tree_rebalance(pt_root); t_insert_result._pt_adjust = pt_root; return t_insert_result; } /* else insert into right subtree */ else { t_insert_result = _avl_tree_insert_avlnode(cpt_avl_tree, pt_root->_pt_right, cpv_value); pt_root->_pt_right = t_insert_result._pt_adjust; pt_root->_pt_right->_pt_parent = pt_root; pt_root = _avl_tree_rebalance(pt_root); t_insert_result._pt_adjust = pt_root; return t_insert_result; } }
/** * Get the maximum number of elements int the avl tree. */ size_t _avl_tree_max_size(const _avl_tree_t* cpt_avl_tree) { assert(cpt_avl_tree != NULL); assert(_avl_tree_is_inited(cpt_avl_tree)); return (size_t)(-1) / _GET_AVL_TREE_TYPE_SIZE(cpt_avl_tree); }
/** * Return an iterator to the first element that is equal to or greater than a specific element. */ _avl_tree_iterator_t _avl_tree_lower_bound(const _avl_tree_t* cpt_avl_tree, const void* cpv_value) { _avlnode_t* pt_cur = NULL; _avlnode_t* pt_prev = NULL; bool_t b_less = false; bool_t b_greater = false; _avl_tree_iterator_t it_iter; assert(cpt_avl_tree != NULL); assert(cpv_value != NULL); assert(_avl_tree_is_inited(cpt_avl_tree)); it_iter = _create_avl_tree_iterator(); _AVL_TREE_ITERATOR_TREE_POINTER(it_iter) = (void*)cpt_avl_tree; if (!_avl_tree_empty(cpt_avl_tree)) { pt_prev = cpt_avl_tree->_t_avlroot._pt_parent; b_less = b_greater = _GET_AVL_TREE_TYPE_SIZE(cpt_avl_tree); _avl_tree_elem_compare_auxiliary(cpt_avl_tree, cpv_value, pt_prev->_pby_data, &b_less); _avl_tree_elem_compare_auxiliary(cpt_avl_tree, pt_prev->_pby_data, cpv_value, &b_greater); pt_cur = (b_less || !b_greater) ? pt_prev->_pt_left : pt_prev->_pt_right; while (pt_cur != NULL) { pt_prev = pt_cur; b_less = b_greater = _GET_AVL_TREE_TYPE_SIZE(cpt_avl_tree); _avl_tree_elem_compare_auxiliary(cpt_avl_tree, cpv_value, pt_prev->_pby_data, &b_less); _avl_tree_elem_compare_auxiliary(cpt_avl_tree, pt_prev->_pby_data, cpv_value, &b_greater); pt_cur = (b_less || !b_greater) ? pt_prev->_pt_left : pt_prev->_pt_right; } if (b_less || !b_greater) { assert(pt_prev->_pt_left == NULL); _AVL_TREE_ITERATOR_COREPOS(it_iter) = (_byte_t*)pt_prev; assert(_avl_tree_iterator_belong_to_avl_tree(cpt_avl_tree, it_iter)); } else { assert(pt_prev->_pt_right == NULL); _AVL_TREE_ITERATOR_COREPOS(it_iter) = (_byte_t*)pt_prev; it_iter = _avl_tree_iterator_next(it_iter); } } else { it_iter = _avl_tree_end(cpt_avl_tree); } return it_iter; }
/** * Tests if the first avl tree is less than the second avl tree. */ bool_t _avl_tree_less(const _avl_tree_t* cpt_first, const _avl_tree_t* cpt_second) { _avl_tree_iterator_t it_first; _avl_tree_iterator_t it_first_begin; _avl_tree_iterator_t it_first_end; _avl_tree_iterator_t it_second; _avl_tree_iterator_t it_second_begin; _avl_tree_iterator_t it_second_end; bool_t b_result = false; assert(cpt_first != NULL); assert(cpt_second != NULL); assert(_avl_tree_is_inited(cpt_first)); assert(_avl_tree_is_inited(cpt_second)); assert(_avl_tree_same_type_ex(cpt_first, cpt_second)); it_first_begin = _avl_tree_begin(cpt_first); it_first_end = _avl_tree_end(cpt_first); it_second_begin = _avl_tree_begin(cpt_second); it_second_end = _avl_tree_end(cpt_second); /* test each element */ for (it_first = it_first_begin, it_second = it_second_begin; !_avl_tree_iterator_equal(it_first, it_first_end) && !_avl_tree_iterator_equal(it_second, it_second_end); it_first = _avl_tree_iterator_next(it_first), it_second = _avl_tree_iterator_next(it_second)) { b_result = _GET_AVL_TREE_TYPE_SIZE(cpt_first); _GET_AVL_TREE_TYPE_LESS_FUNCTION(cpt_first)( ((_avlnode_t*)_AVL_TREE_ITERATOR_COREPOS(it_first))->_pby_data, ((_avlnode_t*)_AVL_TREE_ITERATOR_COREPOS(it_second))->_pby_data, &b_result); if (b_result) { return true; } b_result = _GET_AVL_TREE_TYPE_SIZE(cpt_first); _GET_AVL_TREE_TYPE_LESS_FUNCTION(cpt_first)( ((_avlnode_t*)_AVL_TREE_ITERATOR_COREPOS(it_second))->_pby_data, ((_avlnode_t*)_AVL_TREE_ITERATOR_COREPOS(it_first))->_pby_data, &b_result); if (b_result) { return false; } } return _avl_tree_size(cpt_first) < _avl_tree_size(cpt_second) ? true : false; }
/** * Destroy the subtree with postorder traverse. */ _avlnode_t* _avl_tree_destroy_subtree(_avl_tree_t* pt_avl_tree, _avlnode_t* pt_root) { bool_t b_result = false; assert(pt_avl_tree != NULL); assert(_avl_tree_is_inited(pt_avl_tree) || _avl_tree_is_created(pt_avl_tree)); if (pt_root != NULL) { pt_root->_pt_left = _avl_tree_destroy_subtree(pt_avl_tree, pt_root->_pt_left); pt_root->_pt_right = _avl_tree_destroy_subtree(pt_avl_tree, pt_root->_pt_right); assert(pt_root->_pt_left == NULL && pt_root->_pt_right == NULL); b_result = _GET_AVL_TREE_TYPE_SIZE(pt_avl_tree); _GET_AVL_TREE_TYPE_DESTROY_FUNCTION(pt_avl_tree)(pt_root->_pby_data, &b_result); assert(b_result); _alloc_deallocate(&pt_avl_tree->_t_allocator, pt_root,_AVL_TREE_NODE_SIZE(_GET_AVL_TREE_TYPE_SIZE(pt_avl_tree)), 1); } return NULL; }
/** * Tests if the two avl tree are equal. */ bool_t _avl_tree_equal(const _avl_tree_t* cpt_first, const _avl_tree_t* cpt_second) { _avl_tree_iterator_t it_first; _avl_tree_iterator_t it_first_begin; _avl_tree_iterator_t it_first_end; _avl_tree_iterator_t it_second; _avl_tree_iterator_t it_second_begin; _avl_tree_iterator_t it_second_end; bool_t b_less = false; bool_t b_greater = false; assert(cpt_first != NULL); assert(cpt_second != NULL); assert(_avl_tree_is_inited(cpt_first)); assert(_avl_tree_is_inited(cpt_second)); assert(_avl_tree_same_type_ex(cpt_first, cpt_second)); if (cpt_first == cpt_second) { return true; } /* test avl tree size */ if (_avl_tree_size(cpt_first) != _avl_tree_size(cpt_second)) { return false; } it_first_begin = _avl_tree_begin(cpt_first); it_first_end = _avl_tree_end(cpt_first); it_second_begin = _avl_tree_begin(cpt_second); it_second_end = _avl_tree_end(cpt_second); /* test each element */ for (it_first = it_first_begin, it_second = it_second_begin; !_avl_tree_iterator_equal(it_first, it_first_end) && !_avl_tree_iterator_equal(it_second, it_second_end); it_first = _avl_tree_iterator_next(it_first), it_second = _avl_tree_iterator_next(it_second)) { b_less = b_greater = _GET_AVL_TREE_TYPE_SIZE(cpt_first); _GET_AVL_TREE_TYPE_LESS_FUNCTION(cpt_first)( ((_avlnode_t*)_AVL_TREE_ITERATOR_COREPOS(it_first))->_pby_data, ((_avlnode_t*)_AVL_TREE_ITERATOR_COREPOS(it_second))->_pby_data, &b_less); _GET_AVL_TREE_TYPE_LESS_FUNCTION(cpt_first)( ((_avlnode_t*)_AVL_TREE_ITERATOR_COREPOS(it_second))->_pby_data, ((_avlnode_t*)_AVL_TREE_ITERATOR_COREPOS(it_first))->_pby_data, &b_greater); if (b_less || b_greater) { return false; } } assert(_avl_tree_iterator_equal(it_first, it_first_end) && _avl_tree_iterator_equal(it_second, it_second_end)); return true; }
/** * Get data value referenced by iterator. */ void _avl_tree_iterator_get_value(_avl_tree_iterator_t it_iter, void* pv_value) { assert(pv_value != NULL); assert(_avl_tree_iterator_belong_to_avl_tree(_AVL_TREE_ITERATOR_TREE(it_iter), it_iter)); assert(!_avl_tree_iterator_equal(it_iter, _avl_tree_end(_AVL_TREE_ITERATOR_TREE(it_iter)))); /* char* */ if (strncmp(_GET_AVL_TREE_TYPE_BASENAME(_AVL_TREE_ITERATOR_TREE(it_iter)), _C_STRING_TYPE, _TYPE_NAME_SIZE) == 0) { *(char**)pv_value = (char*)string_c_str((string_t*)((_avlnode_t*)_AVL_TREE_ITERATOR_COREPOS(it_iter))->_pby_data); } else { bool_t b_result = _GET_AVL_TREE_TYPE_SIZE(_AVL_TREE_ITERATOR_TREE(it_iter)); _GET_AVL_TREE_TYPE_COPY_FUNCTION(_AVL_TREE_ITERATOR_TREE(it_iter))( pv_value, ((_avlnode_t*)_AVL_TREE_ITERATOR_COREPOS(it_iter))->_pby_data, &b_result); assert(b_result); } }
/** * Initialize element auxiliary function */ void _avl_tree_init_elem_auxiliary(_avl_tree_t* pt_avl_tree, _avlnode_t* pt_node) { assert(pt_avl_tree != NULL); assert(pt_node != NULL); assert(_avl_tree_is_inited(pt_avl_tree) || _avl_tree_is_created(pt_avl_tree)); /* initialize new elements */ if (_GET_AVL_TREE_TYPE_STYLE(pt_avl_tree) == _TYPE_CSTL_BUILTIN) { /* get element type name */ char s_elemtypename[_TYPE_NAME_SIZE + 1]; _type_get_elem_typename(_GET_AVL_TREE_TYPE_NAME(pt_avl_tree), s_elemtypename); _GET_AVL_TREE_TYPE_INIT_FUNCTION(pt_avl_tree)(pt_node->_pby_data, s_elemtypename); } else { bool_t b_result = _GET_AVL_TREE_TYPE_SIZE(pt_avl_tree); _GET_AVL_TREE_TYPE_INIT_FUNCTION(pt_avl_tree)(pt_node->_pby_data, &b_result); assert(b_result); } }
/** * Inserts an array of unique element into a avl tree. */ void _avl_tree_insert_unique_array(_avl_tree_t* pt_avl_tree, const void* cpv_array, size_t t_count) { size_t i = 0; assert(pt_avl_tree != NULL); assert(_avl_tree_is_inited(pt_avl_tree)); assert(cpv_array != NULL); /* * Copy the elements from src array to dest avl tree. * The array of c builtin and user define or cstl builtin are different, * the elements of c builtin array are element itself, but the elements of * c string, user define or cstl are pointer of element. */ if (strncmp(_GET_AVL_TREE_TYPE_BASENAME(pt_avl_tree), _C_STRING_TYPE, _TYPE_NAME_SIZE) == 0) { /* * We need built a string_t for c string element. */ string_t* pstr_elem = create_string(); assert(pstr_elem != NULL); string_init(pstr_elem); for (i = 0; i < t_count; ++i) { string_assign_cstr(pstr_elem, *((const char**)cpv_array + i)); _avl_tree_insert_unique(pt_avl_tree, pstr_elem); } string_destroy(pstr_elem); } else if (_GET_AVL_TREE_TYPE_STYLE(pt_avl_tree) == _TYPE_C_BUILTIN) { for (i = 0; i < t_count; ++i) { _avl_tree_insert_unique(pt_avl_tree, (unsigned char*)cpv_array + i * _GET_AVL_TREE_TYPE_SIZE(pt_avl_tree)); } } else { for (i = 0; i < t_count; ++i) { _avl_tree_insert_unique(pt_avl_tree, *((void**)cpv_array + i)); } } }
/* * Erase an element in an avl tree from specificed position. */ void _avl_tree_erase_pos(_avl_tree_t* pt_avl_tree, _avl_tree_iterator_t it_pos) { _avlnode_t* pt_parent = NULL; _avlnode_t* pt_cur = NULL; bool_t b_result = false; assert(pt_avl_tree != NULL); assert(_avl_tree_is_inited(pt_avl_tree)); assert(_avl_tree_iterator_belong_to_avl_tree(pt_avl_tree, it_pos)); assert(!_avl_tree_iterator_equal(it_pos, _avl_tree_end(pt_avl_tree))); pt_cur = (_avlnode_t*)_AVL_TREE_ITERATOR_COREPOS(it_pos); pt_parent = pt_cur->_pt_parent; /* delete node X express deleting */ if (pt_cur->_pt_left == NULL && pt_cur->_pt_right == NULL) { if (pt_parent == &pt_avl_tree->_t_avlroot) { /* * P P * | => * X */ pt_parent->_pt_parent = NULL; } else if (pt_cur == pt_parent->_pt_left) { /* * P P * / => * X */ pt_parent->_pt_left = NULL; } else { /* * P P * \ => * X */ pt_parent->_pt_right = NULL; } } else if (pt_cur->_pt_left != NULL && pt_cur->_pt_right == NULL) { if (pt_parent == &pt_avl_tree->_t_avlroot) { /* * P P * | | * X => L * / * L */ pt_parent->_pt_parent = pt_cur->_pt_left; pt_parent->_pt_parent->_pt_parent = pt_parent; } else if (pt_cur == pt_parent->_pt_left) { /* * P P * / / * X => L * / * L */ pt_parent->_pt_left = pt_cur->_pt_left; pt_parent->_pt_left->_pt_parent = pt_parent; } else { /* * P P * \ \ * X => L * / * L */ pt_parent->_pt_right = pt_cur->_pt_left; pt_parent->_pt_right->_pt_parent = pt_parent; } } else if (pt_cur->_pt_left == NULL && pt_cur->_pt_right != NULL) { if (pt_parent == &pt_avl_tree->_t_avlroot) { /* * P P * | | * X => R * \ * R */ pt_parent->_pt_parent = pt_cur->_pt_right; pt_parent->_pt_parent->_pt_parent = pt_parent; } else if (pt_cur == pt_parent->_pt_right) { /* * P P * \ \ * X => R * \ * R */ pt_parent->_pt_right = pt_cur->_pt_right; pt_parent->_pt_right->_pt_parent = pt_parent; } else { /* * P R * / / * X => R * \ * R */ pt_parent->_pt_left = pt_cur->_pt_right; pt_parent->_pt_left->_pt_parent = pt_parent; } } else { _avlnode_t* pt_parenttmp = NULL; _avlnode_t* pt_curtmp = NULL; if (pt_parent == &pt_avl_tree->_t_avlroot) { pt_curtmp = _avl_tree_get_min_avlnode(pt_cur->_pt_right); if (pt_cur == pt_curtmp->_pt_parent) { /* * P P * | | * X => B * / \ / \ * A B A C * \ * C */ /* pt_curtmp express B */ pt_curtmp->_pt_left = pt_cur->_pt_left; pt_curtmp->_pt_left->_pt_parent = pt_curtmp; pt_curtmp->_pt_parent = pt_cur->_pt_parent; pt_curtmp->_pt_parent->_pt_parent = pt_curtmp; pt_parent = pt_curtmp; } else { /* * P P * | | * X => S * / \ / \ * A B A B * / \ / \ * S C D C * \ * D */ /* pt_curtmp express S; pt_parenttmp express B */ pt_parenttmp = pt_curtmp->_pt_parent; pt_parenttmp->_pt_left = pt_curtmp->_pt_right; if (pt_parenttmp->_pt_left != NULL) { pt_parenttmp->_pt_left->_pt_parent = pt_parenttmp; } pt_curtmp->_pt_left = pt_cur->_pt_left; pt_curtmp->_pt_left->_pt_parent = pt_curtmp; pt_curtmp->_pt_right = pt_cur->_pt_right; pt_curtmp->_pt_right->_pt_parent = pt_curtmp; pt_curtmp->_pt_parent = pt_cur->_pt_parent; pt_curtmp->_pt_parent->_pt_parent = pt_curtmp; pt_parent = pt_parenttmp; } } else if (pt_cur == pt_parent->_pt_left) { pt_curtmp = _avl_tree_get_min_avlnode(pt_cur->_pt_right); if (pt_cur == pt_curtmp->_pt_parent) { /* * P P * / / * X => B * / \ / \ * A B A C * \ * C */ /* pt_curtmp express B */ pt_curtmp->_pt_left = pt_cur->_pt_left; pt_curtmp->_pt_left->_pt_parent = pt_curtmp; pt_curtmp->_pt_parent = pt_cur->_pt_parent; pt_curtmp->_pt_parent->_pt_left = pt_curtmp; pt_parent = pt_curtmp; } else { /* * P P * / / * X => S * / \ / \ * A B A B * / \ / \ * S C D C * \ * D */ /* pt_curtmp express S; pt_parenttmp express B */ pt_parenttmp = pt_curtmp->_pt_parent; pt_parenttmp->_pt_left = pt_curtmp->_pt_right; if (pt_parenttmp->_pt_left != NULL) { pt_parenttmp->_pt_left->_pt_parent = pt_parenttmp; } pt_curtmp->_pt_left = pt_cur->_pt_left; pt_curtmp->_pt_left->_pt_parent = pt_curtmp; pt_curtmp->_pt_right = pt_cur->_pt_right; pt_curtmp->_pt_right->_pt_parent = pt_curtmp; pt_curtmp->_pt_parent = pt_cur->_pt_parent; pt_curtmp->_pt_parent->_pt_left = pt_curtmp; pt_parent = pt_parenttmp; } } else { pt_curtmp = _avl_tree_get_min_avlnode(pt_cur->_pt_right); if (pt_cur == pt_curtmp->_pt_parent) { /* * P P * \ \ * X => B * / \ / \ * A B A C * \ * C */ /* pt_curtmp express B */ pt_curtmp->_pt_left = pt_cur->_pt_left; pt_curtmp->_pt_left->_pt_parent = pt_curtmp; pt_curtmp->_pt_parent = pt_cur->_pt_parent; pt_curtmp->_pt_parent->_pt_right = pt_curtmp; pt_parent = pt_curtmp; } else { /* * P P * \ \ * X => S * / \ / \ * A B A B * / \ / \ * C D C D * / \ / \ * S E F E * \ * F */ /* pt_curtmp express S; pt_parenttmp express C */ pt_parenttmp = pt_curtmp->_pt_parent; pt_parenttmp->_pt_left = pt_curtmp->_pt_right; if (pt_parenttmp->_pt_left != NULL) { pt_parenttmp->_pt_left->_pt_parent = pt_parenttmp; } pt_curtmp->_pt_left = pt_cur->_pt_left; pt_curtmp->_pt_left->_pt_parent = pt_curtmp; pt_curtmp->_pt_right = pt_cur->_pt_right; pt_curtmp->_pt_right->_pt_parent = pt_curtmp; pt_curtmp->_pt_parent = pt_cur->_pt_parent; pt_curtmp->_pt_parent->_pt_right = pt_curtmp; pt_parent = pt_parenttmp; } } } /* rebalance until to root */ if (pt_parent != &pt_avl_tree->_t_avlroot) { _avlnode_t* pt_newcur = pt_parent; pt_parent = pt_newcur->_pt_parent; while (pt_parent != &pt_avl_tree->_t_avlroot) { if (pt_newcur == pt_parent->_pt_left) { pt_parent->_pt_left = _avl_tree_rebalance(pt_parent->_pt_left); pt_parent->_pt_left->_pt_parent = pt_parent; } else { pt_parent->_pt_right = _avl_tree_rebalance(pt_parent->_pt_right); pt_parent->_pt_right->_pt_parent = pt_parent; } pt_newcur = pt_parent; pt_parent = pt_newcur->_pt_parent; } } /* rebalance root */ if (pt_parent->_pt_parent != NULL) { pt_parent->_pt_parent = _avl_tree_rebalance(pt_parent->_pt_parent); pt_parent->_pt_parent->_pt_parent = pt_parent; } /* destroy node */ b_result = _GET_AVL_TREE_TYPE_SIZE(pt_avl_tree); _GET_AVL_TREE_TYPE_DESTROY_FUNCTION(pt_avl_tree)(pt_cur->_pby_data, &b_result); assert(b_result); _alloc_deallocate(&pt_avl_tree->_t_allocator, pt_cur, _AVL_TREE_NODE_SIZE(_GET_AVL_TREE_TYPE_SIZE(pt_avl_tree)), 1); pt_avl_tree->_t_nodecount--; if (pt_avl_tree->_t_nodecount == 0) { pt_avl_tree->_t_avlroot._pt_parent = NULL; pt_avl_tree->_t_avlroot._pt_left = &pt_avl_tree->_t_avlroot; pt_avl_tree->_t_avlroot._pt_right = &pt_avl_tree->_t_avlroot; } else { pt_avl_tree->_t_avlroot._pt_left = _avl_tree_get_min_avlnode(pt_avl_tree->_t_avlroot._pt_parent); pt_avl_tree->_t_avlroot._pt_right = _avl_tree_get_max_avlnode(pt_avl_tree->_t_avlroot._pt_parent); } }