Location:
Search - shellsort111
Search list
Description: 附有本人超级详细解释(看不懂的面壁十天!)
一、 实际问题:
希尔排序(Shell Sort)是插入排序的一种。因D.L.Shell于1959年提出而得名。它又称“缩小增量分类法”,在时间效率上比插入、比较、冒泡等排序算法有了较大改进。能对无序序列按一定规律进行排序。
二、数学模型:
先取一个小于n的整数d1作为第一个增量,把文件的全部记录分成d1个组。所有距离为dl的倍数的记录放在同一个组中。先在各组内进行直接插人排序;然后,取第二个增量d2<d1重复上述的分组和排序,直至所取的增量dt=1(dt<dt-l<…<d2<d1),即所有记录放在同一组中进行直接插入排序为止。该方法实质上是一种分组插入方法。
三、算法设计:
1、将相隔某个增量dlta[k]的元素构成一个子序列。在排序过程中,逐次减小这个增量,最后当h减到1时,进行一次插入排序,排序就完成。增量序列一般采用:dlta[k]=2t-k+1-1,其中t为排序趟数,1≤k≤t≤[log2 (n+1)],其中n为待排序序列的长度。按增量序列dlta[0..t-1]。
2、按增量dlta[k](1≤k≤t≤[log2 (n+1)])进行一趟希尔插入排序。
3、在主函数中控制程序执行流程。
4、时间复杂度:1≤k≤t≤[log2 (n+1)]时为O(n3/2)。
-with super detailed explanation (not read the Wall for 10 days!) A practical question : Sort Hill (Shell Sort) is inserted into a sort. By D. L. Shell made in 1959 and named after. It is also known as the "narrow incremental method" in the time-efficient than inserted, such as sorting algorithms and bubbling there has been a big improvement. The disorder can sequence by law must rank. Two mathematical models : first getting a less than n integers d1 as an increment. all documents should be recorded into d1 groups. All distance dl in multiples of record on the same group. In the first group for direct insertion sorting; Then, take a second increment d2
Platform: |
Size: 19421 |
Author: 乐乐 |
Hits:
Description: 附有本人超级详细解释(看不懂的面壁十天!)
一、 实际问题:
希尔排序(Shell Sort)是插入排序的一种。因D.L.Shell于1959年提出而得名。它又称“缩小增量分类法”,在时间效率上比插入、比较、冒泡等排序算法有了较大改进。能对无序序列按一定规律进行排序。
二、数学模型:
先取一个小于n的整数d1作为第一个增量,把文件的全部记录分成d1个组。所有距离为dl的倍数的记录放在同一个组中。先在各组内进行直接插人排序;然后,取第二个增量d2<d1重复上述的分组和排序,直至所取的增量dt=1(dt<dt-l<…<d2<d1),即所有记录放在同一组中进行直接插入排序为止。该方法实质上是一种分组插入方法。
三、算法设计:
1、将相隔某个增量dlta[k]的元素构成一个子序列。在排序过程中,逐次减小这个增量,最后当h减到1时,进行一次插入排序,排序就完成。增量序列一般采用:dlta[k]=2t-k+1-1,其中t为排序趟数,1≤k≤t≤[log2 (n+1)],其中n为待排序序列的长度。按增量序列dlta[0..t-1]。
2、按增量dlta[k](1≤k≤t≤[log2 (n+1)])进行一趟希尔插入排序。
3、在主函数中控制程序执行流程。
4、时间复杂度:1≤k≤t≤[log2 (n+1)]时为O(n3/2)。
-with super detailed explanation (not read the Wall for 10 days!) A practical question : Sort Hill (Shell Sort) is inserted into a sort. By D. L. Shell made in 1959 and named after. It is also known as the "narrow incremental method" in the time-efficient than inserted, such as sorting algorithms and bubbling there has been a big improvement. The disorder can sequence by law must rank. Two mathematical models : first getting a less than n integers d1 as an increment. all documents should be recorded into d1 groups. All distance dl in multiples of record on the same group. In the first group for direct insertion sorting; Then, take a second increment d2
Platform: |
Size: 19456 |
Author: 乐乐 |
Hits: