/*************************************************************************************************************************************/
/* */
/* O U T I L S D ' U N T R I E N ' N * N ' E N M O D E V I R T U E L : */
/* */
/* */
/* Author of '$xtc/tri_N2.02$I' : */
/* */
/* Jean-Francois COLONNA (LACTAMME, 20220801125908). */
/* */
/*************************************************************************************************************************************/
#define compcl(index1,index2) \
(tableau[permutation[index1]]-tableau[permutation[index2]])
#define echang(index1,index2) \
{ \
int tempo=permutation[index1]; \
permutation[index1] = permutation[index2]; \
permutation[index2] = tempo; \
}
tri(debut,fin)
int debut;
int fin;
{
int index_de_fin;
for (index_de_fin=(fin-1) ; index_de_fin>=debut ; index_de_fin=index_de_fin-1)
{
int index_de_debut;
for (index_de_debut=debut ; index_de_debut<=index_de_fin ; index_de_debut=index_de_debut+1)
{
if (compcl(index_de_debut,index_de_debut+1)>0)
{
echang(index_de_debut,index_de_debut+1);
/* Cette echange conserve l'ordre des elements possedant la meme "clef"... */
}
else
{
}
}
}
return(VRAI);
}