Skip to content

Instantly share code, notes, and snippets.

@Evshved
Last active December 17, 2015 07:09
Show Gist options
  • Save Evshved/5570847 to your computer and use it in GitHub Desktop.
Save Evshved/5570847 to your computer and use it in GitHub Desktop.
Sort n(2), more better than #2
var A:array [1..10] of integer;
key,u,i:integer;
begin
for i:=1 to 10 do
A[i]:=random(10);
for i:=2 to 10 do
begin
key:=A[i];
u:=i-1;
while (u>0) and (A[u]>key) do
begin
A[u+1]:=A[u];
u:=u-1;
A[u+1]:=key;
end;
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment