现在的位置: 首页 > 综合 > 正文

读书笔记之shell排序

2012年03月20日 ⁄ 综合 ⁄ 共 1609字 ⁄ 字号 评论关闭

环境:

[lanux@localhost--Debug--15:29]$uname -sr
Linux 2.6.34.7-61.fc13.i686.PAE
[lanux@localhost--Debug--15:32]$rpm -qa|grep anjuta
anjuta-doc-2.30.2.1-1.fc13.noarch
anjuta-2.30.2.1-1.fc13.i686
anjuta-devel-2.30.2.1-1.fc13.i686
[lanux@localhost--Debug--15:33]$

 

 

此shell排序对增量序列作简单化假设,假设为{0,1,5,19,41}。

 

C代码:



一趟shell排序:

 

增量序列假设:

 

shell排序:

 

结果示例:

[lanux@localhost--Debug--15:33]$./shellsort
array number fallow as:
   841    372    566    967    201    692    967     94    192    486
   784    308     96    922    452     43    433    429    519    856
   962    780    830    910    316    265    932    547    194    491
The shell sort follow:
    43     94     96    192    194    201    265    308    316    372
   429    433    452    486    491    519    547    566    692    780
   784    830    841    856    910    922    932    962    967    967
[lanux@localhost--Debug--15:46]$

 

2010-12-03  15:47:00

 

抱歉!评论已关闭.