Sort 알고리즘(합병정렬-Merge Sort)
import java.util.Random; class MergeSort2 { //Recursion을 이용한 Merge Sort public static int[] mergesort(int a[ ], int first, int n) { int n1; int n2; if (n > 1) { n1 = n/2; n2=n-n1; mergesort(a, first, n1); mergesort(a, first+n1, n2); merge(a, first, n1, n2); } return a; } private static void merge(int[ ] a, int first, int n1, int n2) { int[ ] temp = new int[n1+n2]; int copied = 0; int copied1 = 0..
더보기