list sort( r )
list r;
{
list head[M], tail[M];
int i, j, h;
for (i=D; i>0; i--) {
for (j=0; jk );
if ( head[h]==NULL ) head[h] = r;
else tail[h]->next = r;
tail[h] = r;
r = r->next;
};
/*** Concatenate lists ***/
r = NULL;
for (j=M-1; j>=0; j--)
if ( head[j] != NULL ) {
tail[j]->next = r;
r = head[j];
}
};
return( r );
};
|