Sha256: ce4a8011fe3a5fbcb970b0c8ec5f5ab8fcfc3c494358da22ca0ea8c6da0df868

Contents?: true

Size: 397 Bytes

Versions: 1

Compression:

Stored size: 397 Bytes

Contents

class Array
	
	def sort_for

		@aux = self

		for x in 0..self.length-1
			for y in 0..length-2-x
				if ( @aux[y] > @aux[y+1] )
					@aux[y], @aux[y+1] = @aux[y+1], @aux[y] 
				end
			end
		end

		return @aux

	end

	def sort_each
		
		@aux = self
		@pos = 0

		@aux.each do |x|
			@pos = @pos + 1
			@aux[@pos..@aux.length-1] do |y|
				if (x>y)
					x, y = y, x
				end
			end
		end
	end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prct06_alu0100958607-0.1.0 lib/prct06/array.rb