1,选择排序和冒泡排序有什么不同
2,下面完全不懂解释一下,
为什么for i=1 to 9
这句什么意思p=i
为什么for j=i+1 to 10
如果a(p)>a(j) then p=j,冒泡好以不用then p=j, 这个p=j有什么用
if a(p)>a(j) then p=j
next j
temp=a(i)
a(i)=a(p)
a(p)=temp
next i
private sub form_load()
dim a(1 to 10) as integer
dim i as integer
dim j as integer
dim temp as integer
dim p as integer
print
print "排序前数组:";
for i=1 to 10
randomize
a(i)=((100-10)*rnd+10)
print a(i);" ";
next i
print
for i=1 to 9
p=i
for j=i+1 to 10
if a(p)>a(j) then p=j
next j
temp=a(i)
a(i)=a(p)
a(p)=temp
next i
print "排序后数组:";
for i=1 to 10
print a(i);" ";
next i
end sub
解释这段啊,
for i=1 to 9
p=i
for j=i+1 to 10
if a(p)>a(j) then p=j
next j
temp=a(i)
a(i)=a(p)
a(p)=temp
next i
你这个不知道在说些什么
这个都看不懂你还学什么,最简单的冒泡排序都看不懂的话就别说看别的了,只要你把我上面那段代码看懂其他的你就都看的懂了。