I'm reading an introduction to algorithm complexity text and the author has examples in several different languages, which I have been able to follow along. Then at the crucial moment he hits me this Ruby code which is Greek to me. Can someone explain what this code does?
b = []
n.times do
m = a[ 0 ]
mi = 0
a.each_with_index do |element, i|
if element < m
m = element
mi = i
end
end
a.delete_at( mi )
b << m
end