add numerical recipes library
This commit is contained in:
15
lib/nr/k_and_r/recipes/reverse.c
Normal file
15
lib/nr/k_and_r/recipes/reverse.c
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
void reverse(iorder,ncity,n)
|
||||
int iorder[],n[],ncity;
|
||||
{
|
||||
int nn,j,k,l,itmp;
|
||||
|
||||
nn=(1+((n[2]-n[1]+ncity) % ncity))/2;
|
||||
for (j=1;j<=nn;j++) {
|
||||
k=1 + ((n[1]+j-2) % ncity);
|
||||
l=1 + ((n[2]-j+ncity) % ncity);
|
||||
itmp=iorder[k];
|
||||
iorder[k]=iorder[l];
|
||||
iorder[l]=itmp;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user