Skip to content

Instantly share code, notes, and snippets.

@DasLampe
Created June 9, 2009 09:06
Show Gist options
  • Save DasLampe/126372 to your computer and use it in GitHub Desktop.
Save DasLampe/126372 to your computer and use it in GitHub Desktop.
h := 1; // Shell-Sort
repeat
h := 3 * h + 1;
until h > LBoxDemo.Items.Count - 1;
repeat
h := h div 3;
for i := h to (LBoxDemo.Items.Count - 1) do
begin
str := LBoxDemo.Items[i];
j := i;
while ((j >= h) and (LBoxDemo.Items[j-h] > str)) do
begin
LBoxDemo.Items[j] := LBoxDemo.Items[j-h];
j := j - h;
end;
LBoxDemo.Items[j] := str;
end;
until h <= 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment