Bubble sort algorithm example from TThread demo of Delphi 5: Sorting an array of Integer: procedure TBubbleSort.Sort(var A: array of Integer); var I, J, T: Integer; begin for I := High(A) downto Low(A) do for J := Low(A) to High(A) - 1 do if A[J] > A[J + 1] then begin VisualSwap(A[J], A[J + 1], J, J + 1); T := A[J]; A[J] := A[J + 1]; A[J + 1] := T; if Terminated then Exit; end; end; Sorting a TStringList ( It's recommended that you use the TStringList.Sort procedure, since it is a Quicksort implementation which is faster):
Identifier (URI) | Rank |
---|---|
dbkwik:resource/KvQrscZcX82HEqWT6k1nLg== | 5.88129e-14 |
dbr:Bubble_sort | 5.88129e-14 |
dbkwik:resource/BHG8V5lECFLMaUwkXE4KOw== | 5.88129e-14 |