nbsp;a[NN];
int i;
struct sNode *p, *h, *s;
srand(time(NULL));
initList( &p);
for(i = 0; i < NN; i++){
a[i] = rand() & MM;
}
printf( "随机数序列:");
for(i = 0; i < NN; i++){
printf( "%5d", a[i]);
}
printf( " ");
printf( "随机数逆序:");
for(i = 0; i < NN; i++){
insertFirstList( &p, a[i]);
}
traverseList(p);
printf( "单链表长度:%5d ", sizeList(p));
for(h = p; h != NULL; h = h- >next){
while(deleteValueList( &(h->next), h->data)){
;
}
}
printf( "去除重复数:");
traverseList(p);
printf( "单链表长度:%5d ", sizeList(p));
h = NULL;
for(s = p; s != NULL; s = s- >next){
insertOrderList( &h, s->data);
}
printf( "有序表序列:");
traverseList(h);
clearList( &p);
system( "pause");
return 0;
}