[题目分析]本题要求建立有序的循环链表从头到尾扫描数组A取出A[i](<=i<n)然后到链表中去查找值为A[i]的结点若查找失败则插入
LinkedList creat(ElemType A[]int n)
//由含n个数据的数组A生成循环链表要求链表有序并且无值重复结点
{LinkedList h;
h=(LinkedList)malloc(sizeof(LNode));//申请结点
h>next=h; //形成空循环链表
for(i=;i<n;i++)
{pre=h;
p=h>next;
while(p!=h && p>data<A[i])
{pre=p; p=p>next;} //查找A[i]的插入位置
if(p==h || p>data!=A[i]) //重复数据不再输入
{s=(LinkedList)malloc(sizeof(LNode));
s>data=A[i]; pre>next=s; s>next=p;//将结点s链入链表中
}
}//for
return(h);
}算法结束
[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []