http://v.youku.com/v_show/id_XMjU4NTcwMDIw.html
[b][flash=480,400]http://player.youku.com/player.PHP/sid/XMjU4NTcwMDIw/v.swf[/flash][/b]
[b][flv=480,400][b][flash=480,400]http://player.youku.com/player.PHP/sid/XMjU4NTcwMDIw/v.swf[/flash] [/b][/flv]
[/b]
看完了吧,再看一篇,,发现这个都是倒序向前比较,步长是span。
自己强化学习一下:
- PublicClassForm1@H_301_29@
- PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.Click@H_301_29@
- ListBox1.Items.Clear()@H_301_29@
- ListBox2.Items.Clear()@H_301_29@
- Dimi,j,spanAsShort@H_301_29@
- Dima(10)AsString,tempAsString@H_301_29@
- Randomize()@H_301_29@
- @H_301_29@
- Fori=0Toa.Length-1@H_301_29@
- a(i)=Int(10*Rnd())@H_301_29@
- ListBox1.Items.Add(a(i))@H_301_29@
- Next@H_301_29@
- span=a.Length\2@H_301_29@
- DoWhilespan>0@H_301_29@
- Fori=spanToa.Length-1@H_301_29@
- Forj=i-spanTo0Step-span@H_301_29@
- Ifa(j)<=a(j+span)ThenExitFor@H_301_29@
- temp=a(j)@H_301_29@
- a(j)=a(j+span)@H_301_29@
- a(j+span)=temp@H_301_29@
- Next@H_301_29@
- span=span\2@H_301_29@
- Loop@H_301_29@
- ListBox2.Items.Add(a(i))@H_301_29@
- EndSub@H_301_29@
- EndClass@H_301_29@