From: "A.Appleyard" Organization: Materials Science Centre To: DJGPP AT DELORIE DOT COM Date: Wed, 12 Jun 1996 08:55:46 GMT Subject: Useful source form fragments? Message-ID: <2B4FE460DCF@fs2.mt.umist.ac.uk> (1) Compact bubble sort:- typedef struct {double x; rhubarb; rhubarb; rhubarb; rhubarb;} miaow; miaow X[256]; /* sort miaow[B] to miaow[N] inclusive into ascending order of element x */ miaow *I,*J,W; for(k=1,I=X+N;k;I--) for(k=0,J=X+B;JJ[1].x) { k=1; W=J[0]; J[0]=J[1]; J[1]=W; } /* the outer loop stops when the inner loop finds no more sorting to do */ (1) Compact permutation:- int i,j,x[N],b[N],e[N],n=N; for(i=0;i0; x[i]=b[i]) for(i--; (++x[i])<=e[i]; i=n-1) { /* XX */ for(j=0;j