Data update

This commit is contained in:
Ingy döt Net 2025-02-27 18:35:13 -05:00
parent 8e4e15fa56
commit 72eb4943cb
1853 changed files with 35514 additions and 9441 deletions

View file

@ -0,0 +1,25 @@
procedure ShellSort(var a: array of extended);
var
i, j, h, n: integer;
v: extended;
begin
n := length(a);
h := 1;
repeat
h := 3 * h + 1
until h > n;
repeat
h := h div 3;
for i := h to n - 1 do
begin
v := a[i];
j := i;
while (j >= h) and (a[j - h] > v) do
begin
a[j] := a[j - h];
j := j - h;
end;
a[j] := v;
end
until h = 1;
end;

View file

@ -0,0 +1,29 @@
procedure ShellSort(var a: array of extended);
{ Sorts a vector of arbitrary length }
{ Requirement: Support for open arrays by Object Pascal compiler }
{ otherwise please use the algorithm for Pascal, which is less flexible, }
{ but also supported by Object Pascal }
var
i, j, h, n: integer;
v: extended;
begin
n := length(a);
h := 1;
repeat
h := 3 * h + 1
until h > n;
repeat
h := h div 3;
for i := h to n - 1 do
begin
v := a[i];
j := i;
while (j >= h) and (a[j - h] > v) do
begin
a[j] := a[j - h];
j := j - h;
end;
a[j] := v;
end
until h = 1;
end;