/*相较于6-5并无本质区别,两题要点都是一样的,选做一题即可*/
List MakeEmpty()
{
List L=(List)malloc(sizeof(struct LNode));
L->Next=NULL;
return L;
}
Position Find( List L, ElementType X )
{
while(L&&L->Next)
{
if(L->Data==X) return L;
L=L->Next;
}
if(L->Data==X) return L;
return ERROR;
}
bool Insert( List L, ElementType X, Position P )
{
List p=(List)malloc(sizeof(struct LNode));
p->Data=X;
p->Next=NULL;
List pb=L;
if(L==P) {
p->Next=L;
L=p;
return true;
}
while(pb->Next!=P&&pb->Next!=NULL)
{
pb=pb->Next;
}
if(pb->Next==P){
{
List L=(List)malloc(sizeof(struct LNode));
L->Next=NULL;
return L;
}
Position Find( List L, ElementType X )
{
while(L&&L->Next)
{
if(L->Data==X) return L;
L=L->Next;
}
if(L->Data==X) return L;
return ERROR;
}
bool Insert( List L, ElementType X, Position P )
{
List p=(List)malloc(sizeof(struct LNode));
p->Data=X;
p->Next=NULL;
List pb=L;
if(L==P) {
p->Next=L;
L=p;
return true;
}
while(pb->Next!=P&&pb->Next!=NULL)
{
pb=pb->Next;
}
if(pb->Next==P){