归并排序
class Solution { public: void merge(int A[], int m, int B[], int n) { int temp_result[m+n]; int current_inadex = 0; int i = 0; int j = 0; while(i< m&&j<n){ if(A[i] < B[j]){ temp_result[current_inadex++] = A[i++]; }else{ temp_result[current_inadex++] = B[j++]; } } for(;i<m;){ temp_result[current_inadex ++ ] = A[i++]; } for(;j<n;){ temp_result[current_inadex ++ ] = B[j++]; } for(int i = 0; i< m+n;i++){ A[i] = temp_result[i]; } } };