class Array
Public Instance Methods
each_sort()
click to toggle source
# File lib/pract/sort.rb, line 13 def each_sort aux = self.each_with_index do |i, m| self.each_with_index do |j, n| if self[m] < self[n] self[m], self[n] = self[n], self[m] end end end return aux end
for_sort()
click to toggle source
# File lib/pract/sort.rb, line 2 def for_sort for i in 0..self.size-2 for j in i..self.size-1 if self[i] > self[j] self[i], self[j] = self[j], self[i] end end end return self end
show_vector()
click to toggle source
# File lib/pract/sort.rb, line 28 def show_vector self.map{|i| p i.to_s} end
sort_sort()
click to toggle source
# File lib/pract/sort.rb, line 24 def sort_sort aux = self.sort #{|a, b| b <=> a } end