def selection_sort(a) b = [] a.size.times do |i| min = a.min b << min a.delete_at(a.index(min)) end return b end