コード例 #1
0
ファイル: bs_lib_avl.c プロジェクト: adoregnu/bs_lib
static int32_t avl_get_height(avl_node_t* node)
{
	if(NULL == node)
		return 0;

	return 1 + max(avl_get_height(node->left_child), 
				avl_get_height(node->right_child));
}
コード例 #2
0
ファイル: bs_lib_avl.c プロジェクト: adoregnu/bs_lib
static int32_t avl_get_balance(avl_node_t* node)
{
	if(NULL == node)
	{
		return 0;
	}
	return avl_get_height(node->left_child) - 
			avl_get_height(node->right_child);
}
コード例 #3
0
void tree_print(tree_node *tn) {
    avl_node *node = (avl_node*)tn;
    printf("%d :: %d -> %d", avl_get_height(node), avl_get_balance(node), *(int*)node->value);
}