all tasks

This commit is contained in:
Ingy döt Net 2013-04-11 01:07:29 -07:00
parent b83f433714
commit 68f8f3e56b
14735 changed files with 178959 additions and 0 deletions

View file

@ -0,0 +1,22 @@
;sorts an array of integers
Procedure combSort11(Array a(1))
Protected i, gap, swaps = 1
Protected nElements = ArraySize(a())
gap = nElements
While (gap > 1) Or (swapped = 1)
gap * 10 / 13
If gap = 9 Or gap = 10: gap = 11: EndIf
If gap < 1: gap = 1: EndIf
i = 0
swaps = 0
While (i + gap) <= nElements
If a(i) > a(i + gap)
Swap a(i), a(i + gap)
swaps = 1
EndIf
i + 1
Wend
Wend
EndProcedure

View file

@ -0,0 +1,20 @@
;sorts an array of integers
Procedure combSort(Array a(1))
Protected i, gap, swaps = 1
Protected nElements = ArraySize(a())
gap = nElements
While (gap > 1) Or (swaps = 1)
gap = Int(gap / 1.25)
i = 0
swaps = 0
While (i + gap) <= nElements
If a(i) > a(i + gap)
Swap a(i), a(i + gap)
swaps = 1
EndIf
i + 1
Wend
Wend
EndProcedure