Bonjour,
donc voila le problème j'ai un expose sur le tri par insertion et je veux savoir le principe de ce tri et l'explication de langage pascale de ce tri.
MERCI.
Combien cela coûte-t-il au total ? Quelles aides apportent l'état et les acteurs du marché pour alléger cette charge non choisie ? Tous les détails sur Commentçamarche.net.
program tri_par_insertion; const N=10; type ttab=array[1..N] of integer; var cnt:integer; tab:ttab ; temp:integer; pos:integer; function trouveouinserer(tab1:ttab;ideb,ifin,aval:integer):integer; var cnt2:integer; trouve:boolean; begin cnt2:=ideb; trouve:=false; repeat if aval<tab1[cnt2] then trouve:=true else cnt2:=cnt2+1; until((trouve) or (cnt2>ifin)); trouveouinserer:=cnt2; end; procedure decale(var tab2:ttab;ideb,ifin:integer); var cnt3:integer; begin for cnt3:=ifin downto ideb do begin tab2[cnt3+1]:=tab2[cnt3]; end ; end; begin for cnt:=1 to N do begin writeln('numero ',cnt); read(tab[cnt]) end; for cnt:=2 to N do begin temp:=tab[cnt]; pos:=trouveouinserer(tab,1,cnt-1,temp); decale(tab,pos,N); tab[pos]:=temp; end; for cnt:=1 to N do begin writeln('numero ',cnt,' =',tab[cnt]); readln; end; end.pour c de 2 à n faire
si t[c-1]>t[c] alors
Tmp <-- t[c]
Proc decaler (t,c-1,p)
t[p+1]<--Tmp
fin si
fin pour
fin tri-insertion
procedure decaler (vat t:tab,deb:entier,var fin:entier)
tanque (fin>=1)et (t[fin]<Tmp) faire
t[fin+1] <-- t[fin]
fin <-- fin-1
fin tant que
fin decaler
{VOILA LE L'ALGORITHME DU TRI-INSERTION }
SI VOUS VOULEZ DE L'AIDE CONTACTER MOI SUR MON E-MAIL
""""""""""""""""""""""""""" NOUNOU_KOBEJASON85@HOTMAIL.COM """""""""""""""""""""""""""""""""""