Difference between revisions of "BubbleSort"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> procedure BubbleSort(var Values: TIntegerArray); </source> ==Availability== SCAR Divi 3.00 > Current ==Description== Uses the ...")
 
(Availability)
Line 5: Line 5:
  
 
==Availability==
 
==Availability==
SCAR Divi 3.00 > Current
+
SCAR Divi 3.10 > Current
  
 
==Description==
 
==Description==

Revision as of 08:43, 2 July 2011

Definition

procedure BubbleSort(var Values: TIntegerArray);

Availability

SCAR Divi 3.10 > Current

Description

Uses the bubblesort sorting algorithm to sort a given set of integer values specified by the TIntegerArray Values. The values will be sorted small->large.

Example

var
  Values: TIntegerArray;
  i: Integer;
begin
  Values := [9, 1, 8, 2, 4];
  BubbleSort(Values);
  for i := Low(Values) to High(Values) do
    WriteLn(Values[i]);
end.

Output:

1
2
4
8
9

See Also