惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
L
LangChain Blog
Jina AI
Jina AI
爱范儿
爱范儿
C
Check Point Blog
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
月光博客
月光博客
GbyAI
GbyAI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Stack Overflow Blog
Stack Overflow Blog
V
V2EX
A
About on SuperTechFans
有赞技术团队
有赞技术团队
Microsoft Azure Blog
Microsoft Azure Blog
The GitHub Blog
The GitHub Blog
博客园 - Franky
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题

博客园 - Forrest Gump

关于LINQ中数据库连接字符串的问题 项目开发经验-ASP.NET项目开发中的异常处理 关于模态窗口(showModalDialog)的专题【收藏】 C#面试题 C# 将数据导出到Excel汇总 关于Assembly.CreateInstance()与Activator.CreateInstance()方法 PowerDesigner概念设计模型(CDM)中的3种实体关系 C#基础概念二十五问 Microsoft .NET Pet Shop 4:将 ASP.NET 1.1 应用程序迁移到 2.0 用Inno Setup制作WEB程序安装包 冒泡法数组排序与 System.Array.Sort()排序性能比较 堆排序 (Heap sort) 合并排序法(Merge Sort) quick sort 关于switch的小技巧 C#中一些很基础但有经常导致错误的一些概念 Enterprise Library Step By Step系列(十六):使用AppSetting Application Block Enterprise Library Step By Step系列(十五):配置应用程序块——设计篇 创建基于消息队列(MSMQ)的异步日志
希尔排序法
Forrest Gump · 2008-01-28 · via 博客园 - Forrest Gump

using System; 

public class ShellSorter 

public void Sort(int [] list) 

int inc; 
for(inc=1;inc<=list.Length/9;inc=3*inc+1); 
for(;inc>0;inc/=3

for(int i=inc+1;i<=list.Length;i+=inc) 

int t=list[i-1]; 
int j=i; 
while((j>inc)&&(list[j-inc-1]>t)) 

list[j
-1]=list[j-inc-1]; 
j
-=inc; 
}
 
list[j
-1]=t; 
}
 
}
 
}
 
}
 
public class MainClass 

public static void Main() 

int[] iArrary=new int[]{1,5,3,6,10,55,9,2,87,12,34,75,33,47}
ShellSorter sh
=new ShellSorter(); 
sh.Sort(iArrary); 
for(int m=0;m<=13;m++
Console.WriteLine(
"{0}",iArrary[m]); 
}
 
}