(转)SHELL SORT
来源:互联网 发布:top域名价格 编辑:程序博客网 时间:2024/06/18 03:59
' SHELL SORT
'Written by Sanchit Karve AKA born2c0de
'born2c0de AT hotmail DOT com
'Translated to .net by Margus Martsepp AKA m2s87
Sub shellsort(ByRef A() As Integer, ByVal max As Integer)
Dim stopp%, swap%, limit%, temp%, k%
Dim x As Integer = Int((max / 2) - 1)
Do While x > 0
stopp = 0
limit = max - x
Do While stopp = 0
swap = 0
For k = 0 To limit
If A(k) > A(k + x) Then
temp = A(k)
A(k) = A(k + x)
A(k + x) = temp
swap = k
End If
Next k
limit = swap - x
If swap = 0 Then stopp = 1
Loop
x = Int(x / 2)
Loop
End Sub
Sub Main()
Dim I As Integer
Dim x() As Integer = {5, 2, 4, 6, 1, 3}
Console.WriteLine("Unsorted Array:")
For I = 0 To x.GetUpperBound(0)
Console.Write("{0} ", x(I))
Next I
shellsort(x, x.GetUpperBound(0))
Console.WriteLine("{0}SORTED ARRAY:", Chr(10))
For I = 0 To x.GetUpperBound(0)
Console.Write("{0} ", x(I))
Next I
End Sub
- (转)SHELL SORT
- 希尔排序(Shell Sort)
- 希尔排序(Shell Sort)
- 希尔排序(shell sort)
- 希尔排序(Shell Sort)
- 希尔排序(Shell Sort)
- 希尔排序(Shell Sort)
- 希尔排序(Shell Sort)
- 希尔排序(shell sort)
- 希尔排序(Shell Sort)
- 希尔排序(Shell Sort)
- 希尔排序(shell sort)
- 希尔排序(Shell Sort)
- 希尔排序(shell sort)
- shell sort
- shell sort
- shell sort
- shell sort
- 最近一段时间遇到的问题
- (转)排序算法
- 模块间接口设计的原则
- VC学习日志--摘录(12.13)
- 项目组的激励策略
- (转)SHELL SORT
- linux文件管理器的不足
- JavaScript隐藏代码
- 重新注册.NET
- 新鲜感
- 2008最新的100句超牛的语言
- 盘点男人必玩的十大游戏 看看你玩过几款?
- ASP.net中访问数据库的几种方式
- 南丰县一村小组被指“管”走330万建房款