Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -0,0 +1,17 @@
|
|||
require "table2"
|
||||
|
||||
local function is_sorted(a)
|
||||
for i = 1, #a - 1 do
|
||||
if a[i] > a[i + 1] then return false end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local function bogosort(a)
|
||||
while not is_sorted(a) do a:shuffle() end
|
||||
end
|
||||
|
||||
local a = {31, 41, 59, 26, 53, 58, 97, 93, 23, 84}
|
||||
print($"Before: \{{a:concat(", ")}}")
|
||||
bogosort(a)
|
||||
print($"After : \{{a:concat(", ")}}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue