C# shell排序
来源:互联网 发布:app store升级mac os 编辑:程序博客网 时间:2024/06/10 04:27
shell排序
/// <summary>
/// shell sort
/// </summary>
/// <param name="dest">待排序数组</param>
/// <param name="swapTimes">移动元素次数</param>
public static void ShellSort(ref int[] dest, ref int swapTimes)
{
for(int delta = dest.Length / 2; delta >= 0; delta /= 2)
{
if(delta == 0)
break;
else
{
for(int i = 0; i < delta; i ++)
{
for(int j = i; j < dest.Length; j += delta)
{
int temp = dest[j];
int tmp = j;
while(tmp >= delta && temp < dest[tmp - delta])
{
dest[tmp] = dest[tmp - delta];
swapTimes ++;
tmp -= delta;
}
dest[tmp] = temp;
}
}
}
}
}
- C# shell排序
- shell排序
- shell排序
- SHELL排序
- Shell排序
- shell排序
- shell排序
- Shell 排序
- Shell排序
- Shell排序
- Shell排序
- shell 排序
- shell排序
- shell排序
- Shell排序
- Shell排序
- Shell排序
- Shell排序
- 回公司
- 使用VS2005制作安装包
- Response.Write,Page.RegisterClientScriptBlock和Page.RegisterStartupScript 的区别
- 关于Excel中的数据如何导入到oracle数据库中.
- 基于角色管理的系统访问控制
- C# shell排序
- 导出Excel的简单方法,并可以解决乱码问题
- C# 快速排序
- win2003详细系统安全设置(iis虚拟主机安全设置)
- ASP.net 2005 与SQLExpress的数据库连接问题
- TMC(交通信息频道)服务即将在北京推出
- C# 两路归并排序
- 疯狂的世界
- 一条晕的语句