Sorting algorithms/Bogosort: Difference between revisions

Content added Content deleted
(→‎Insitux: correction)
Line 3,553: Line 3,553:
=={{header|Yabasic}}==
=={{header|Yabasic}}==
{{trans|FreeBASIC}}
{{trans|FreeBASIC}}
<syntaxhighlight lang="yabasic">
<syntaxhighlight lang="yabasic">dim a(5)
a (0) = 10: a (1) = 1: a (2) = 2: a (3) = -6: a (4) = 3

Bogosort(a())

for i = 0 to arraysize(a(),1) - 1
print a(i), " ";
next i
end

sub shuffle(a())
sub shuffle(a())
n = arraysize(a(),1)
n = arraysize(a(),1)
Line 3,571: Line 3,580:
for i = 0 to n-2
for i = 0 to n-2
if a(i) > a(i+1) then return false : fi
if a(i) > a(i+1) return false
next i
next i
return true
return true
Line 3,580: Line 3,589:
shuffle(a())
shuffle(a())
wend
wend
end sub
end sub</syntaxhighlight>

dim a(5)
a (0) = 10: a (1) = 1: a (2) = 2: a (3) = -6: a (4) = 3

Bogosort(a())

for i = 0 to arraysize(a(),1) - 1
print a(i), " ";
next i
end
</syntaxhighlight>



=={{header|zkl}}==
=={{header|zkl}}==