ArraySort

haxe.ds.ArraySort (Class)

ArraySort provides a stable implementation of merge sort through its sort method. It should be used instead of Array.sort in cases where the order of equal elements has to be retained on all targets.

Static Members

sort(a: Array<sort.T>, cmp: Function): Void

Sorts Array a according to the comparison function cmp, where cmp(x,y) returns 0 if x == y, a positive Int if x > y and a negative Int if x < y.

This operation modifies Array a in place.

This operation is stable: The order of equal elements is preserved.

If a or cmp are null, the result is unspecified.

Name Type
a Array<sort.T>
cmp Function

Private Members

rec(a: Array<rec.T>, cmp: Function, from: Int, to: Int): Void
Name Type
a Array<rec.T>
cmp Function
from Int
to Int

doMerge(a: Array<doMerge.T>, cmp: Function, from: Int, pivot: Int, to: Int, len1: Int, len2: Int): Void
Name Type
a Array<doMerge.T>
cmp Function
from Int
pivot Int
to Int
len1 Int
len2 Int

rotate(a: Array<rotate.T>, cmp: Function, from: Int, mid: Int, to: Int): Void
Name Type
a Array<rotate.T>
cmp Function
from Int
mid Int
to Int

gcd(m: Int, n: Int): Int
Name Type
m Int
n Int
Returns
Int

upper(a: Array<upper.T>, cmp: Function, from: Int, to: Int, val: Int): Int
Name Type
a Array<upper.T>
cmp Function
from Int
to Int
val Int
Returns
Int

lower(a: Array<lower.T>, cmp: Function, from: Int, to: Int, val: Int): Int
Name Type
a Array<lower.T>
cmp Function
from Int
to Int
val Int
Returns
Int

swap(a: Array<swap.T>, i: Int, j: Int): Void
Name Type
a Array<swap.T>
i Int
j Int

compare(a: Array<compare.T>, cmp: Function, i: Int, j: Int): Int
Name Type
a Array<compare.T>
cmp Function
i Int
j Int
Returns
Int