all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,22 @@
|
|||
DIM test(9)
|
||||
test() = 4, 65, 2, -31, 0, 99, 2, 83, 782, 1
|
||||
PROCbubblesort(test(), 10)
|
||||
FOR i% = 0 TO 9
|
||||
PRINT test(i%) ;
|
||||
NEXT
|
||||
PRINT
|
||||
END
|
||||
|
||||
DEF PROCbubblesort(a(), n%)
|
||||
LOCAL i%, l%
|
||||
REPEAT
|
||||
l% = 0
|
||||
FOR i% = 1 TO n%-1
|
||||
IF a(i%-1) > a(i%) THEN
|
||||
SWAP a(i%-1),a(i%)
|
||||
l% = i%
|
||||
ENDIF
|
||||
NEXT
|
||||
n% = l%
|
||||
UNTIL l% = 0
|
||||
ENDPROC
|
||||
Loading…
Add table
Add a link
Reference in a new issue