Difference between revisions of "QuickSort"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> procedure QuickSort(var Values: TIntegerArray); </source> ==Availability== SCAR Divi 3.00 > Current ==Description== Uses the [...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Definition==
 
==Definition==
 
<source lang="scar" lines="false">
 
<source lang="scar" lines="false">
procedure QuickSort(var Values: TIntegerArray);
+
procedure QuickSort(var Values: TIntArray);
 
</source>
 
</source>
  
 
==Availability==
 
==Availability==
SCAR Divi 3.00 > Current
+
SCAR Divi 3.14 > 3.37 <span style="color:#FF0000">(Deprecated, use [[SortTIA]])</span>
 +
 
 +
* '''Values''' was a [[TIntegerArray]] before SCAR Divi 3.28.
  
 
==Description==
 
==Description==
Uses the [http://en.wikipedia.org/wiki/Quicksort quicksort] sorting algorithm to sort a given set of [[integer]] values specified by the [[TIntegerArray]] '''Values'''. The values will be sorted small->large.
+
Uses the [http://en.wikipedia.org/wiki/Quicksort quicksort] sorting algorithm to sort a given set of [[integer]] values specified by the [[TIntArray]] '''Values'''. The values will be sorted small->large.
  
 
==Example==
 
==Example==
 
<source lang="scar">
 
<source lang="scar">
 
var
 
var
   Values: TIntegerArray;
+
   Values: TIntArray;
 
   i: Integer;
 
   i: Integer;
 
begin
 
begin
Line 34: Line 36:
 
*[[BubbleSortB]]
 
*[[BubbleSortB]]
  
[[Category:Functions]]
+
[[Category:Deprecated Functions]]
[[Category:Math Functions]]
 

Latest revision as of 19:34, 10 December 2012

Definition

procedure QuickSort(var Values: TIntArray);

Availability

SCAR Divi 3.14 > 3.37 (Deprecated, use SortTIA)

Description

Uses the quicksort 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];
  QuickSort(Values);
  for i := Low(Values) to High(Values) do
    WriteLn(Values[i]);
end.

Output:

1
2
4
8
9

See Also