Sha256: 5337c805e9c429338df407e8a37575a17e9aff0d9c125802fa1764e7f76603a2
Contents?: true
Size: 356 Bytes
Versions: 4
Compression:
Stored size: 356 Bytes
Contents
def bubble(numbers) for i in (0..numbers.size-1) for j in (i..numbers.size-1) if numbers[i] > numbers[j] temp = numbers[i] numbers[i] = numbers[j] numbers[j] = temp end end end numbers end input = STDIN.gets.split(" ").collect {|i| i.to_i} bubble(input) print input.inject {|output, n| "#{output} #{n}"}
Version data entries
4 entries across 4 versions & 1 rubygems