Skip to content
Snippets Groups Projects
Commit 20a9e048 authored by Lawrence Chung's avatar Lawrence Chung
Browse files

mergeSort draft

parent c6953ff0
No related branches found
No related tags found
No related merge requests found
package sort;
public class mergeSort implements GeneralCompare{
private static GeneralCompare[] aux;
public class mergeSort{
private static Comparable[] aux;
public static void merge(GeneralCompare[] gc, int n){
public static void merge(Comparable x, int n, GeneralCompare gc){
aux = new GeneralCompare[n];
aux = new Comparable[n];
if(n <= 1)
return;
......@@ -20,13 +20,13 @@ public class mergeSort implements GeneralCompare{
for(int k = 1; k <= n; k++){
if(i > j-1)
gc[k] = aux[j++];
x[k] = aux[j++];
else if(j > n)
gc[k] = aux[i++];
else if(compare(aux[j+1],aux[1]) < 0)// ?
gc[k] = aux[j++];
x[k] = aux[i++];
else if(gc.compare(aux[j+1],aux[1]) < 0)// ?
x[k] = aux[j++];
else
gc[k] = aux[i++];
x[k] = aux[i++];
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment