Sha256: 5a838052318d3c2afe96c0c5df79955b32ddd0f7cd32c77d89bff6cf540311b1

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

class Array
    
    def ordenacion_for
        
        aux = self.dup
                
        for i in 0...aux.size
            
            unordered = aux[i...aux.size]
            
            min_value = unordered.min
            min_index = aux.find_index(min_value)
            
            aux[i], aux[min_index] = aux[min_index], aux[i]
            
        end
        
        return aux
    end
    
    def ordenacion_each
        
        aux = self.dup
        
        (0...aux.size).each do |i|
        
            unordered = aux[i...aux.size]
            
            min_value = unordered.min
            min_index = aux.find_index(min_value)
            
            aux[i], aux[min_index] = aux[min_index], aux[i] 
        end
        
        return aux
    end
    
    def ordenacion_sort
        aux = self.dup
        aux.sort
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alimento-0100905144-0.1.1 lib/alimento/ordenacion.rb