typedef struct LNode{
ElemType data;
Struct LNode *next;
}LNode, *LinkList;
LinkList List_HeadInsert(LinkList &L){
LNode *s;
Int x;
L=(LinkList)malloc(sizeof(LNode));
L->next=NULL;
scanf(“%d”,&x);
while(x!=9999){
s=(LNode*)malloc(sizeof(LNode));
s->data=x;
s->next=L->next;
L->next=s;
Scanf(“%d”,&x);
}
return L;
}
LinkList List_TailInsert(LinkList &L){
Int x;
L=(LinkList)malloc(sizeof(LNode));
LNode *s,*r=L;
Scanf(“%d”,&x);
While(x!=9999){
s=(LNode *)malloc(sizeof(LNode));
s->data=x;
r->next=s;
r=s;
scanf(“%d”,&x);
}
r->next=NULL;
return L;
}
LNode *GetElem(LinkList L,int i){
int j=1;
Lnode *p=L->next;
if(i==0)
return L;
if(i<1)
return NULL;
while(p&&j<i){
p=p->next;
j++;
}
return p;
}
LNode *LocateElem(LinkList L,ElemType e){
LNode *p=L->next;
while(p!=NULL&&p->data!=e)
p=p->next;
return p;
}
p=GetElem(Lmi-1);
s->next=p->next;
p->next=s;
s->next=p->next;
p->next=s;
temp=p->next;
p->data=s->data;
s->data=temp;
p=GetElem(L,i-1);
q=p->next;
p->next=q->next;
free(q);
typedef struct DNode{
ElemType data;
struct DNode *prior,*next;
}DNode,*DLinklist;
s->next=p->next;
p->next->prior=s;
s->prior=p;
p->next=s;
p->next=q->next;
q->next->prior=p;
free(q);
#define MaxSize 50
typedef struct(
ElemType data;
int next;
)SLinkList[MaxSize];