//设计一个递归算法,删除不带头结点的单链表L中所有值为x的节点
void Del_X_3(LinkList &L,ElemType x)
{
Node*p;
if(L == NULL)
return ; //递归出口
if(L->data==x)
{
P=L;
L=L->next;
free§;
Del_X_3(L,x); //L为引用,不会引起断链
}
else
Del_X_3(L->next,x);
}
//设计一个递归算法,删除不带头结点的单链表L中所有值为x的节点
void Del_X_3(LinkList &L,ElemType x)
{
Node*p;
if(L == NULL)
return ; //递归出口
if(L->data==x)
{
P=L;
L=L->next;
free§;
Del_X_3(L,x); //L为引用,不会引起断链
}
else
Del_X_3(L->next,x);
}