0
回答
代码的圈复杂度问题
开发十年,就只剩下这套Java开发体系了   

void rb_replace_node(struct rb_node *victim, struct rb_node *new,

             struct rb_root *root)

{

    struct rb_node *parent = rb_parent(victim);


    /* Set the surrounding nodes to point to the replacement */

    if (parent) {

        if (victim == parent->rb_left)

            parent->rb_left = new;

        else

            parent->rb_right = new;

    }
    else {
            root->rb_node = new;

    }
    
    if (victim->rb_left)

        rb_set_parent(victim->rb_left, new);

    if (victim->rb_right)

        rb_set_parent(victim->rb_right, new);


    /* Copy the pointers/colour from the victim to the replacement */

    *new = *victim;

}

 

该代码的圈复杂度是多少?

<无标签>
举报
qiejianwen
发帖于2年前 0回/89阅
顶部