我使用合并排序分割数组后,直到数组长度为k,我应该在k长度数组上使用插入排序,然后继续合并。什么应该是k的最优值?使用插入排序的合并排序的修改版本
另外,我发现与我的类似这些问题,但没有找到一个明确的答案 Choosing minimum length k of array for merge sort where use of insertion sort to sort the subarrays is more optimal than standard merge sort Modification to merge sort to implement merge sort with insertion sort Java
请注意链接的问题使用自底向上合并排序,并开始时将大小为n的数组视为大小为k的n/k个子数组,而不是从顶部向下递归分割数组,数组大小<= k。 k的常见值是32,但我不知道它是否最优。 – rcgldr
我的答案错了吗? =) – MBo