用链表表示的数据的简单选择排序结点的域为数据域data 指针域 next ;链表首指针为head 链表无头结点
selectsort(head)
p=head;
while (p____()____)
{q=p; r=____()____
while(____()____)
{if (____()_____) q=r;
r=____()____;
}
tmp=q>data; q>data=p>data; p>data=tmp; p= ____()____;
}【南京理工大学 三 (分)】
.下面的c函数实现对链表head进行选择排序的算法排序完毕链表中的结点按结点值从小到大链接请在空框处填上适当内容每个空框只填一个语句或一个表达式
#include <stdioh>
typedef struct node {char data; struct node *link; }node;
node *select(node *head)
{node *p*q*r*s;
p=(node *)malloc(sizeof(node));
p>link=head; head=p;
while(p>link!=null)
{q=p>link; r=p;
while (____()____)
{ if (q>link>data<r>link>data) r=q;
q=q>link;
}
if (____()____) {s=r>link; r>link=s>link; s>link= (____()_____); (____()_____);}
(____()____) ;
}
p=head; head=head>link; free(p); return(head);
} 【复旦大学 六(分)】
[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []