Package dsa
Class Merge
- java.lang.Object
-
- dsa.Merge
-
public class Merge extends Object
This library implements merge sort.
-
-
Constructor Summary
Constructors Constructor Description Merge()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
main(String[] args)
Unit tests the library.static void
sort(double[] a)
Sorts the arraya
.static void
sort(int[] a)
Sorts the arraya
.static void
sort(Comparable[] a)
Sorts the arraya
according to the natural order of its objects.static void
sort(Object[] a, Comparator c)
Sorts the arraya
according to the order induced by the comparatorc
.
-
-
-
Method Detail
-
sort
public static void sort(Comparable[] a)
Sorts the arraya
according to the natural order of its objects.- Parameters:
a
- the array to sort.
-
sort
public static void sort(Object[] a, Comparator c)
Sorts the arraya
according to the order induced by the comparatorc
.- Parameters:
a
- the array to sort.c
- the comparator to determine the order of the array.
-
sort
public static void sort(int[] a)
Sorts the arraya
.- Parameters:
a
- the array to sort.
-
sort
public static void sort(double[] a)
Sorts the arraya
.- Parameters:
a
- the array to sort.
-
main
public static void main(String[] args)
Unit tests the library.- Parameters:
args
- the command-line arguments.
-
-