#include #define getpch(type) (type*)malloc(sizeof(type)) struct LNode { int size; int start; int end; struct LNode *next; struct LNode *front; }*L; /*L为头指针 */ typedef struct LNode LN; LN *find; int n; void InsertList(int size,int start) { // 在带头结点的单链线形表头结点后插入LN *p,*s,*t; p=L; t=p->next; s=getpch(LN); //生成新结点s->size=size; s->start=start; s->end=start + size ; s->next=t; //插入 L 中p->next=s; if(t) t->front=s; s->front=p; }//end of InsertList void PrintList() /* 打印 */ { LN *p; int i; p=L->next; printf("\n 空闲区号长度起始位置终止位置 \n"); for(i=1;isize, p->start,p->end); p=p->next; } } void BFSortList() /*最佳适应算法的排序*/ { LN *p,*s,*t; int min_size,i; int size,start,end; t=L->next; p=L->next; for(i=0;inext; min_size = p->size; while(s) { if(min_size > s->size) { min_size=s->size; t=s; } s=s->next; } size=t->si