Wikia

Delphi Programming

Shell sort

2,918pages on
this wiki
Talk3
procedure ShellSort(var aSort: array of integer);
var
  iI, iJ, iK,
  iSize: integer;
  wTemp: integer;
begin
  iSize := High(aSort);
  iK := iSize shr 1;
  while iK > 0 do
  begin
    for iI := 0 to iSize - iK do
    begin
      iJ := iI;
      while (iJ >= 0) and (aSort[iJ] > aSort[iJ + iK]) do
      begin
        wTemp := aSort[iJ];
        aSort[iJ] := aSort[iJ + iK];
        aSort[iJ + iK] := wTemp;
        if iJ > iK then
          Dec(iJ, iK)
        else
          iJ := 0
      end;
    end;
    iK := iK shr 1;
  end;
end;


Code Snippets
DatabasesFiles and I/OForms/WindowsGraphicsNetworkingMath and AlgorithmsMiscellaneousMultimediaSystemVCL

Around Wikia's network

Random Wiki