{
char ss[NUM];
RTRANS(n1->v, ss);
XCHG(ss[mv->x], ss[mv->y]);
TRANS(ss, n2->v);
return 0;
}
long add_node(EP_NODE *node, long r)
{
EP_NODE *p=m_root;
EP_NODE *q;
while(p)
{ q=p;
if(p->v == node->v) return 0;
else if(node->v > p->v) p=p->big;
else if(node->v < p->v) p=p->small;
}
m_ar[r].v=node->v;
m_ar[r].prev=node->prev;
m_ar[r].small=NULL;
m_ar[r].big=NULL;
if(node->v > q->v)
{ q->big= &m_ar[r];
}
else if(node->v < q->v)
{ q->small= &m_ar[r];
}
return 1;
}
/*得到节点所在深度*/
long get_node_depth(EP_NODE *node)
{ long d=0;
while(node->prev)
{ d++;
node=node->prev;
}
return d;
}
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页