INITIATION 
Presque toutes machines 
INSERT,A QUOI ? 
ans la série des tris autocommen-tés,voici le tri par insertion. Quel-ques petites remarques : le pro-gramme est écrit en Basic minimum ou presque pour tourner sur un maximum de machines avec un minimum de modifica-tions. Il est possible toutefois que certaines petites choses ne marchent pas sur votre machine. N'hésitez pas à me poser des questions si vous avez un problème. Toute-fois,je considère que tout les Basics pos-sèdent des DATAS,bien que je sache que 
54 
ça n'est pas vrai,mais il serait dommage de se priver de cette instruction pour une mi-norité (qu'ils m'excusent). De plus,vous au-rez probablement à refaire la présentation,les écrans n'ayant pas les mêmes caracté-ristiques. D'ailleurs,cette rubrique est faite pour vous faire travailler. Alors,au boulot. PS: J'attends toujours vos commentaires et vos suggestions. 
François DUPIN 
1 REM SAVE "TRIINS.BAS
10 REM ---INITIALISATION 
20 PEINT "- JE LIS D'ABORD LE NOMBRE DE NOMS." •
33 READ N
40 PR:NT "- IL Y A ":N:" NOMS." 
52 PEINT "- JE RESERVE DE LA PLACE MEMOI RE PUIS" GO DIM ":S(N) 
70 PEINT " JE CHARGE LES DONNEES DANS L E TABLEAU." 
80 FOR I=1 TO N
9C READ TS'»
100 NEXT
110 PRINT "CASE (CONTENU DU TABLEAU)" 
120 GOSUB 1.025
130 PRINT "- JE VAIS TRIER CE TABLEAU." 
140 PRINT "NB: UN NOM EST PLUS PETIT QU' UN AUTRE" 
150 PRINT." S'IL EST AVANT LUI DANS L' ORDRE ALPHABETHIQUE." 
200 REM PROGRAMME DE TRI  
210 PRINT "- JE CONSIDERE QUE LE TABLEAU EST TRIE DE LA CASE
1 A LA CASE
1." • 
221 FOR P1=2 TO N 
230 WS=TS(P1) 
240 PRINT "- JE CHERCHE OU INSERER
1":W5 
I PI 
250 PRINT " DANS LA PARTIE TRIEE DU TA BLEAU." 
260 FOR P2=1 TO ?1-1
271 E=E+1 
280 PRINT "? JE COMPARE LE CONTENU DE LA CASE ":P2:"ET ":Pl 
290 PRINT " JE CONSTATE QUE
1";TSiP1):" 
300 IF T.YP1))TS(P21 THEN 420 
310 PRINT " EST PLUS PETIT QUE '":TS(P2 .,«
320 PRINT "- JE SAUVE ":T.SPI} 
330 FOR P3=P1 TO P2+1 STEP-1
340 PRINT "- JE DECALE LE CONTENU DE "P3 -1"EN "P3
350 D=D+1
360 TPP3)=TS(P3-1)
370 GOSUB 1020 
381 NEXT ?3
390 PRINT "ET JE METS 'n S:"' ":"A LA PLACE LIBRE."
400 TS.P2=WS,
410 MO
490 
420 PRINT "N'EST PAS PLUS PETIT QUE '";T S(P2):"'" 
430 PRINT " ALORS,JE CONTINUE."
441 GOSUB 1020 
450 NEXT P2 
460 PRINT "- J'AI FINI LA PARTIE TRIEE," 
470 PRINT "
1":TS(P2):" EST DONC A SA PLACE." 
480 PRINT "- LE TABLEAU EST TRIE DE LA C ASE
1 A LA CASE":P1:"." 
490 GOSUB 1020 
500 NEXT Pl 
510 PRINT "- TABLEAU TRIE EN ":E;" TESTS 
520 PRINT " ET ":D:"DEPLACEMENTS."
531 END 
1000 REM ----SOUS PROGRAMME  
1010 REM --D'AFFICHAGE DU TABLEAU 
1020 PRINT" 
1030 FOR I=1 TO'N 
1040 PRINT I; 
1050 IF I>=P1 THEN 1080 
1060 PRINT " T "; 
1070 GOTO 1085 
1080 PRINT " ":
1085 IF I=P1 OR I=P2 THEN 1110
1090 PRINT " ":
1103 GOTO 1120
1110 PRINT "-) ": 
1120 PRINT TS(I) 
1130 NEXT I
1140 INPUT" SUITE";RS
1150 RETURN . 
9000 REM DONNEES A TRIER 
9010 DATA 8
9020 DATA GEORGES,JEAN-PAUL,VICTOR,JEAN-JACQUES 
9030 DATA ALBERT,EDOUARD,CHARLES,HECTOR,JEAN-LOUP