BubbleSort

From SCAR Divi Manual
Revision as of 18:51, 24 October 2011 by Freddy (talk | contribs)
Jump to: navigation, search

Definition

procedure BubbleSort(var Values: TIntArray);

Availability

SCAR Divi 3.10 > Current (Deprecated, use SortTIA)

Description

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

Example

var
  Values: TIntArray;
  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