Sorting Algorithm

Download

Download jar file or use maven. psjava requires Java 1.6 (or above)

<dependency>
    <groupId>org.psjava</groupId>
    <artifactId>psjava</artifactId>
    <version>0.1.19</version>
</dependency>

Example Code

// Following example is a normal usage.

MutableArray<Integer> array1 = MutableArrayFromVarargs.create(2, 1, 3);
MergeSort.getInstance().sort(array1, new DefaultComparator<Integer>());

// There is only one method in the 'Sort' interface,
// but there are several convenient methods in 'SortHelper' class
// Following is a partial sorting example.

MutableArray<Integer> array2 = MutableArrayFromVarargs.create(100, 3, 2, 1, 0);
SortingHelper.sort(MergeSort.getInstance(), array2, 1, 4);

See Also


Copyright 2014 psjava team. View on GitHub