home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disc 35
/
Commodore_Disc_35_19xx_-_de.d64
/
bubble-sort.int
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
398b
|
15 lines
100 input"anzahl der werte";d:print
110 dim e%(d),a%(d)
120 fori=1tod:e%(i)=int(rnd(1)*32768):a%(i)=e%(i):next
130 at=ti:gosub190:at=ti-at
140 fori=1tod:printe%(i),a%(i):next
150 print:printat:end
160 rem ------------------------------
170 rem bubble-sort integer
180 rem ------------------------------
190 forj=d-1to1step-1:fori=jtod-1
200 ifa%(i)<=a%(i+1)theni=d-1:goto220
210 a=a%(i):a%(i)=a%(i+1):a%(i+1)=a
220 nexti:nextj:return
230 rem ------------------------------