/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        T E S T   C R O I S S A N T   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$c' :                                                                                             */
/*                                                                                                                                   */
/*                    Jean-Francois COLONNA (LACTAMME, AAAAMMJJhhmmss).                                                              */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

#include  <stdio.h>

extern    double    drand48();
#define   RANDOM                                                                                                                        \
                    (drand48()-0.5)

#define   FACTEUR                                                                                                                       \
                    4

#define   INDEX0                                                                                                                        \
                    0
#define   INDEXn                                                                                                                        \
                    10

#define   VRAI                                                                                                                          \
                    1
#define   FAUX                                                                                                                          \
                    0

static    int       tableau[INDEXn-INDEX0+1];
static    int       permutation[INDEXn-INDEX0+1];

#include  "tri_N2.02.I"

main()
          {
          int       n;

          for       (n=INDEX0 ; n<=INDEXn ; n++)
                    {
                    tableau[n] = (int)(FACTEUR*RANDOM);
                    permutation[n] = n;
                    printf("\n tableau[%02d]=%d",n,tableau[n]);
                    }
          printf("\n");

          tri(INDEX0,INDEXn);

          for       (n=INDEX0 ; n<=INDEXn ; n++)
                    {
                    printf("\n tableau[%02d-->%02d]=%d",permutation[n],n,tableau[permutation[n]]);
                    }
          }



Copyright © Jean-François COLONNA, 2022-2024.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / École polytechnique, Institut Polytechnique de Paris, 2022-2024.