all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
dim insSort(100)
|
||||
sortEnd = 0
|
||||
global inSort
|
||||
global sortEnd
|
||||
|
||||
' -- insert some random numbers --
|
||||
|
||||
for i = 1 to 20
|
||||
a = int(1000 * rnd(1))
|
||||
x = insertSort(a)
|
||||
next i
|
||||
|
||||
' --- Print the Sorted Data -----
|
||||
|
||||
print "End Sort:";sortEnd ' number sorted
|
||||
for i = 1 to sortEnd
|
||||
print i;" ";insSort(i) ' location and sorted data
|
||||
next i
|
||||
wait
|
||||
|
||||
function insertSort(x) ' Insert Sort Function
|
||||
i = 1
|
||||
while x > insSort(i) and i <= sortEnd
|
||||
i = i + 1
|
||||
wend
|
||||
for j = sortEnd to i step -1
|
||||
insSort(j + 1) = insSort(j)
|
||||
next j
|
||||
insSort(i) = x
|
||||
sortEnd = sortEnd + 1
|
||||
end function
|
||||
Loading…
Add table
Add a link
Reference in a new issue