bubble sort by pooq

input""b
dim n(b)
for g=1to b
input""n(g)next
for i=1to b
for j=1to b-i
c=c+1
t=n(j+1)
if t<n(j)s=s+1:n(j+1)=n(j):n(j)=t
?"compare = ",c using"##","   swap = ",s using"##","   data: ";
for k=1to b?n(k)using"##";next
?next
next

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page