2013年12月23日

算法:希尔排序(Shell Sort)

摘要: 背景在三种简单的排序算法中(冒泡、选择和插入)插入排序的算法最好,不过插入过程可能需要进行大量的移动,如何尽可能少的移动元素呢?希尔排序正是基于对这个问题的思考而想出来的,考虑到希尔排序对已排序数组的排序效率尤为好(接近O(n)),因此希尔排序会先按照较大的间隔,对间隔的元素进行插入排序,然后将间隔缩小重复上述过程,直到间隔为 1。实现 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7. 阅读全文

posted @ 2013-12-23 09:57 幸福框架 阅读(582) 评论(0) 推荐(0) 编辑

导航

我要啦免费统计