Merge sort is an effective sorting algorithm based on the merge operation. It can be used to sort the overall disorder but the sub-items are relatively ordered, and to find the reverse logarithm. The specific idea is: During the merging process, the reverse logarithm of each small interval is calculated, and then the reverse logarithm of the large interval is calculated.
Merge sort (MERGE-SORT) is an effective sorting algorithm based on merge operations. The algorithm uses the divide and conquer method (Divide and Conquer). ) is a very typical application. Merge the already ordered subsequences to obtain a completely ordered sequence; that is, first make each subsequence orderly, and then make the subsequence segments orderly. If two ordered lists are merged into one ordered list, it is called a two-way merge. Merge sort is a stable sorting method.
Purpose
Sort
(The speed is second only to quick sort, it is a stable sorting algorithm, generally used For a sequence that is generally disordered but each sub-item is relatively ordered, please refer to the standard procedure of Question 3 of the 2011 Popular Semi-finals "Swiss Round")
Find the reverse logarithm
The specific idea is to calculate the reverse logarithm of each small interval during the merging process, and then calculate the reverse logarithm of the large interval (it can also be solved using a tree array)
The above is the detailed content of What is the use of merge sort?. For more information, please follow other related articles on the PHP Chinese website!