归并排序递归版
#include <stdio.h>
void merge(int arr[], int left, int mid, int right, int t[]) {
//merge()的前提时[left,mid-1]和[mid,right]都各自有序
for (int i = left; i <= right; i++) // 先把原数组[left,right]的数搬到t[]
t[i] = arr[i];
int i = left, j = mid;
int k = left;
while (i < mid && j <= right) //对t[left,right]归并排序到arr[left,right]
if (t[i] < t[j])
arr[k++] = t[i++];
else
arr[k++] = t[j++];
while (i < mid)
arr[k++] = t[i++];
while (j <= right)
arr[k++] = t[j++];
}
void