program QuickSort; uses Crt,Dos; const N = 10000; type Item = Integer; dBase = array [0..N-1] of Item; var a: dBase; hour1,minut1,sec1,canti1, hour2,minut2,sec2,canti2: Word; i: Integer; procedure Q1Sort(var a: dBase; L,R: Integer); var i,j,k: Integer; w,x: Item; begin i := L; j := R; x := a[(L+R) div 2]; repeat while a[i] < x do inc(i); while x < a[j] do dec(j); if i <= j then begin if i<j then begin w := a[i]; a[i] := a[j]; a[j] := w; end; inc(i); dec(j); end; until i > j; if L < j then Q1Sort (a,L,j); if i < R then Q1Sort (a,i,R); end; { Sort } Begin ClrScr; { Randomize; } For i:=0 to N-1 do { Масив випадкових чисел } begin a[i] := random(1000); end; { For i:= 0 to N-1 do begin Write(a[i],' '); end; WriteLn; } GetTime(hour1,minut1,sec1,canti1); Q1Sort(a,0,N-1); GetTime(hour2,minut2,sec2,canti2); { For i:= 0 to N-1 do begin Write(a[i],' '); end; WriteLn; } { ClrScr; } writeln(' Початок: ',hour1:2,':',minut1:2,':',sec1:2,':',canti1:2); writeln(' Кінець: ',hour2:2,':',minut2:2,':',sec2:2,':',canti2:2); End.