2.2 Algoritmlarni saralashga doir misollarni Pascal ABC dagi dastur kodi.
Saralagan ro’yxat algoritmiga doir dastur.
Ma’lumotni tez saralash algoritmiga doir misol
Tanlangan ro’yxatni saralash algoritmini dasturi
Raqamlarni sodda saralash algoritmiga dastur
begin
writeln('Katta vaqt: ');
var count := 0;
var beg := Random(1000000000)+2;
for var i:=beg to beg+5000 do
begin
var f := True;
var j := 2;
var r := round(sqrt(i));
while f and (j<=r) do
if i mod j = 0 then f := false
else j += 1;
if f then
begin
write(i,' ');
Inc(count);
if count mod 5 = 0 then writeln;
end;
end;
end.
Do'stlaringiz bilan baham: |