About: Bubble sort   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

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):

AttributesValues
rdfs:label
  • Bubble sort
rdfs:comment
  • 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):
sameAs
dcterms:subject
dbkwik:delphi/prop...iPageUsesTemplate
abstract
  • 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): function BubbleSort( list: TStringList ): TStringList; var i, j: Integer; temp: string; begin // bubble sort for i := 0 to list.Count - 1 do begin for j := 0 to ( list.Count - 1 ) - i do begin // Condition to handle i=0 & j = 9. j+1 tries to access x[10] which // is not there in zero based array if ( j + 1 = list.Count ) then continue; if ( list.Strings[j] > list.Strings[j+1] ) then begin temp := list.Strings[j]; list.Strings[j] := list.Strings[j+1]; list.Strings[j+1] := temp; end; // endif end; // endwhile end; // endwhile Result := list; end;
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software