The Merge Sorting method combines two (or more) ordered tables into a new ordered table, that is, the sequence to be sorted is divided into several subsequences, each of which is ordered. Then combine the ordered subsequences into the overall ordered sequence. Merge Sorting is an effective Sorting Algorithm Based on merge operations. This algorithm is a very typical application of Divide and Conquer. Merges ordered subsequences to obtain a fully ordered sequence. That is, first orders each subsequence, and then orders the subsequence segments. If two ordered tables are merged into an ordered table, it is called a 2-way merge. First, consider how to merge the two ordered series. This is very simple, as long as we compare the first number of two columns, who is the first to take the first, and then delete the number in the corresponding series. Then compare the data. If the number of columns is null, extract the data of the other series in sequence. [Cpp] // merge the ordered arrays a [] and B [] into c [] void MemeryArray (int a [], int n, int B [], int m, int c []) {int I, j, k; I = j = k = 0; while (I <n & j <m) {if (a [I] <B [j]) c [k ++] = a [I ++]; else c [k ++] = B [j ++];} while (I <n) c [k ++] = a [I ++]; while (j <m) c [k ++] = B [j ++];} it can be seen that the efficiency of merging ordered series is relatively high, which can reach O (n ). The preceding merge sequence problem is solved. Let's look at the merge sequence. The basic idea is to divide the array into two groups A and B. If the data in these two groups is ordered, this makes it easy to sort the two groups of data. How can we make the data in these two groups orderly? Group A and Group B can be further divided into two groups. And so on. When the split group has only one data, you can think that the group has reached an order, and then merge the two adjacent groups. In this way, the merging order is completed by recursively decomposing the series and then merging the series. [Cpp] // merge two ordered Series a [first... mid] And a [mid... last. Void mergearray (int a [], int first, int mid, int last, int temp []) {int I = first, j = mid + 1; int m = mid, n = last; int k = 0; while (I <= m & j <= n) {if (a [I] <= a [j]) temp [k ++] = a [I ++]; else temp [k ++] = a [j ++];} while (I <= m) temp [k ++] = a [I ++]; while (j <= n) temp [k ++] = a [j ++]; for (I = 0; I <k; I ++) a [first + I] = temp [I];} void mergesort (int a [], int first, int last, int temp []) {If (first <last) {int mid = (first + last)/2; mergesort (a, first, mid, temp); // left ordered mergesort (, mid + 1, last, temp); // right ordered mergearray (a, first, mid, last, temp ); // merge two more ordered series} bool MergeSort (int a [], int n) {int * p = new int [n]; if (p = NULL) return false; mergesort (a, 0, n-1, p); delete [] p; return true: the efficiency of merge sorting algorithms is much faster than the previous descriptions (insert, bubble, exchange, and fast. However, an additional declarative space is required to store the merged data, while there is still a lot of fast sorting in the application. You can select an efficient sorting method based on your individual needs.