2018-09-10 00:36:53 +00:00
|
|
|
import java.util.List;
|
2018-09-11 19:59:20 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.lang.String;
|
2018-09-10 00:36:53 +00:00
|
|
|
|
2018-10-17 12:29:12 +00:00
|
|
|
public class Sorting{
|
2018-09-10 00:36:53 +00:00
|
|
|
merge(a, b){
|
|
|
|
a.addAll(b);
|
|
|
|
return a;
|
|
|
|
}
|
2019-06-06 10:15:51 +00:00
|
|
|
|
2018-09-26 13:40:51 +00:00
|
|
|
sort(in){
|
|
|
|
var firstHalf = in;
|
|
|
|
var secondHalf = in;
|
|
|
|
return merge(sort(firstHalf), sort(secondHalf));
|
|
|
|
}
|
2019-02-27 15:04:55 +00:00
|
|
|
|
2019-06-06 10:15:51 +00:00
|
|
|
|
|
|
|
/*
|
2019-02-27 15:04:55 +00:00
|
|
|
void sort(a){
|
2018-09-11 19:59:20 +00:00
|
|
|
a = merge(a,a);
|
|
|
|
}
|
2019-06-06 10:15:51 +00:00
|
|
|
*/
|
2018-09-11 19:59:20 +00:00
|
|
|
}
|