home *** CD-ROM | disk | FTP | other *** search
/ Commodore Disc 35 / Commodore_Disc_35_19xx_-_de.d64 / bubble-sort.int (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  398b  |  15 lines

  1. 100 input"anzahl der werte";d:print
  2. 110 dim e%(d),a%(d)
  3. 120 fori=1tod:e%(i)=int(rnd(1)*32768):a%(i)=e%(i):next
  4. 130 at=ti:gosub190:at=ti-at
  5. 140 fori=1tod:printe%(i),a%(i):next
  6. 150 print:printat:end
  7. 160 rem ------------------------------
  8. 170 rem bubble-sort integer
  9. 180 rem ------------------------------
  10. 190 forj=d-1to1step-1:fori=jtod-1
  11. 200 ifa%(i)<=a%(i+1)theni=d-1:goto220
  12. 210 a=a%(i):a%(i)=a%(i+1):a%(i+1)=a
  13. 220 nexti:nextj:return
  14. 230 rem ------------------------------
  15.