Skip to content

Instantly share code, notes, and snippets.

@jparedes
Created March 27, 2012 15:18
Show Gist options
  • Select an option

  • Save jparedes/2216853 to your computer and use it in GitHub Desktop.

Select an option

Save jparedes/2216853 to your computer and use it in GitHub Desktop.
My RADIX sort implementation in Ruby
def radixSort(array)
temp = Array.new
array.each do |x|
if temp[x] == nil
temp[x] = 1
else
temp[x] = temp[x] + 1
end
end
temp.each_with_index do |x, i|
if (x)
x.times do
puts i
end
end
end
end
def run()
test = [9,8,7,5,5,5,4,3,1]
radixSort(test)
end
run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment