唐山饭店招聘:asp排序算法

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/29 15:43:22
关于用asp编写排序的程序,(冒泡,插入)等.写出程序,谢谢.
感谢给我提供答案的.可是要用asp来做这程序.

数字都在a(n)中
下面排序
dim b
for i=1 to n
for j= i to n
if a(i)>a(j) then
b=a(i)
a(i)=a(j)
a(j)=b
end if
next
next

for i = 1 to n - 1
forj=1 to n -j
if a(j) > a(j+1) then swap a(j),a(j+1)
next j
next i
(冒泡法)
for i = 1 to n -1
p=i
for j = i+1 to n
if a(p)>a(j) then p = j
next j
if p<> i then swap a(p),a(i)
next i
(选择法)