2018-08-06 11:25:41 +00:00
|
|
|
import java.util.List;
|
|
|
|
import java.lang.Integer;
|
2019-01-04 00:19:31 +00:00
|
|
|
//import java.util.Collection;
|
2018-08-06 11:25:41 +00:00
|
|
|
|
2024-03-14 12:50:56 +00:00
|
|
|
public class Merge {
|
2018-08-06 11:25:41 +00:00
|
|
|
|
2024-03-14 12:50:56 +00:00
|
|
|
public merge(a, b) {
|
2018-08-06 11:25:41 +00:00
|
|
|
a.addAll(b);
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
2018-08-06 11:34:34 +00:00
|
|
|
|
2018-08-13 16:28:41 +00:00
|
|
|
|
2024-03-14 12:50:56 +00:00
|
|
|
public sort(in){
|
2018-08-06 11:25:41 +00:00
|
|
|
var firstHalf = in.subList(1,2);
|
|
|
|
var secondHalf = in.subList(1,2);
|
|
|
|
return merge(sort(firstHalf), sort(secondHalf));
|
|
|
|
}
|
2018-08-13 16:28:41 +00:00
|
|
|
|
2018-08-06 11:25:41 +00:00
|
|
|
}
|