Sorting algorithms/Bubble sort: Difference between revisions

Line 1,739:
end
</syntaxhighlight>
 
==={{header|micro(A) BASIC}}===
'bubble sort in micro(A) BASIC
wcolor 0,0,0 : fcolor 150,180,240
var start,endtime,time
var sort,index,size,temp1,temp2,x,xl,y
size = 1000 : x = 10 : y = 20 : xl = 40
var list[size]
index = 1
GETTICK start
'---------------------------------------------
label do1
list[index] = rand(100)
index = index + 1
if index < size : goto do1 : endif
'---------------------------------------------
label do2
sort = 0
index = 1
label do3
'---------------------------------------------
temp1 = index + 1
if list[index] > list[temp1]
temp2 = list[index]
list[index] = list[temp1]
list[temp1] = temp2
sort = 1
endif
index = index + 1
if index < size - 1 : goto do3 : endif
'-----------------------------------------------
if sort = 1 : goto do2 : endif
'-----------------------------------------------
index = 1
GETTICK endtime
time = (endTime - start) / 1000
fcolor 230,140,120: print 300,10,time : swap
index = 970
'check sort /////////////////////////////////////
label do4
print x,y ,index : print xl,y, list[index]
y = y + 20 : swap
index = index + 1
swap
if index < 1000 : goto do4 :endif
'////////////////////////////////////////////////
 
==={{header|Minimal BASIC}}===
3

edits