Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,20 @@
module Indexable::Mutable
def stooge_sort!
stooge_sort_impl 0, size-1
self
end
private def stooge_sort_impl (i, j)
swap(i, j) if self[i] > self[j]
if j - i + 1 > 2
t = (j - i + 1) // 3
stooge_sort_impl i, j-t
stooge_sort_impl i+t, j
stooge_sort_impl i, j-t
end
end
end
arr = Array(Int32).new(15) { (-50..100).sample }
puts "before: #{arr}"
puts "after: #{arr.stooge_sort!}"