Node *CreateAtTail(DataType a[],int n)
{
int i;
Node *first,*s,*r;
first=InitList();
r=first;
for(i=0;i<n;i++)
{
s=(Node *)malloc(sizeof(Node));
s->data=a[i];
r->next=s;
r=s;
}
r->next=NULL;
return first;
}
DataType Get(Node *first,int i)
{
Node *p;
int count=0;
p=first;
while(p->next!=NULL&&count<i)
{
p=p->next;
count++;
}
if(count==i)
return p->data;
else
return -1;
}
int Locate(Node *first,DataType x)
{
Node *p = first->next;
int count=1;
while(p!=NULL&&p->data!=x)
{
p=p->next;
count++;
}
if(p!=NULL)
{
return count;
}
else
return 0;
}