Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,35 @@
DECLARE SUB stoogesort (L() AS LONG, i AS LONG, j AS LONG)
RANDOMIZE TIMER
CONST arraysize = 10
DIM x(arraysize) AS LONG
DIM i AS LONG
PRINT "Before: ";
FOR i = 0 TO arraysize
x(i) = INT(RND * 100)
PRINT x(i); " ";
NEXT
PRINT
stoogesort x(), 0, arraysize
PRINT "After: ";
FOR i = 0 TO arraysize
PRINT x(i); " ";
NEXT
PRINT
SUB stoogesort (L() AS LONG, i AS LONG, j AS LONG)
IF L(j) < L(i) THEN SWAP L(i), L(j)
IF (j - i) > 1 THEN
DIM t AS LONG
t = (j - i + 1) / 3
stoogesort L(), i, j - t
stoogesort L(), i + t, j
stoogesort L(), i, j - t
END IF
END SUB