Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by 109000114 ( 5 years ago )
int ln,rn;
    sz[root->id]=1;
    if(root->left)
        Traversal(root->left,sz);
    if(root->right)
        Traversal(root->right,sz);

    if(root->left&&root->right)
    {
        ln=sz[root->left->id];
        rn=sz[root->right->id];
        if(ln>rn)
            sz[root->id]+=ln;
        else
            sz[root->id]+=rn;
    }
    else if(root->left&&root->right==NULL)
        ln=sz[root->left->id],sz[root->id]+=ln;
    else if(root->right&&root->left==NULL)
        rn=sz[root->right->id],sz[root->id]+=rn;

 

Revise this Paste

Children: 116040
Your Name: Code Language: