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