Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
sub decr( byref n )
|
||||
n = n - 1
|
||||
end sub
|
||||
|
||||
sub incr( byref n )
|
||||
n = n + 1
|
||||
end sub
|
||||
|
||||
sub swap( byref a, byref b)
|
||||
dim tmp
|
||||
tmp = a
|
||||
a = b
|
||||
b = tmp
|
||||
end sub
|
||||
|
||||
function bubbleSort( a )
|
||||
dim changed
|
||||
dim itemCount
|
||||
itemCount = ubound(a)
|
||||
do
|
||||
changed = false
|
||||
decr itemCount
|
||||
for i = 0 to itemCount
|
||||
if a(i) > a(i+1) then
|
||||
swap a(i), a(i+1)
|
||||
changed = true
|
||||
end if
|
||||
next
|
||||
loop until not changed
|
||||
bubbleSort = a
|
||||
end function
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
dim a
|
||||
a = array( "great eastern", "roe", "stirling", "albany", "leach")
|
||||
wscript.echo join(a,", ")
|
||||
bubbleSort a
|
||||
wscript.echo join(a,", ")
|
||||
Loading…
Add table
Add a link
Reference in a new issue