Skip to content

Instantly share code, notes, and snippets.

@Evshved
Created October 5, 2013 16:41
Show Gist options
  • Save Evshved/6843123 to your computer and use it in GitHub Desktop.
Save Evshved/6843123 to your computer and use it in GitHub Desktop.
Еще одна сортировка вставкой N(2) По возрастанию.
var A:array[1..10] of integer;
cou1,cou2,k,varib1,max,ind1:integer;
begin
read(k);
for cou1:=1 to k do
begin
A[cou1]:=random(10)+10;
end;
for cou1:=k downto 1 do
begin
max:=A[cou1];
ind1:=cou1;
for cou2:=1 to cou1-1 do
begin
if max<A[cou2] then
begin
max:=A[cou2];
ind1:=cou2;
end;
end;
varib1:=A[cou1];
A[cou1]:=max;
A[ind1]:=varib1;
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment