changed not alot
This commit is contained in:
parent
7c95d2a96c
commit
8891f1c975
2 changed files with 6 additions and 9 deletions
|
@ -8,4 +8,4 @@ require "algorithms"
|
||||||
|
|
||||||
# (If you use this, don't forget to add pry to your Gemfile!)
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
||||||
require "pry"
|
require "pry"
|
||||||
Pry.start
|
Pry.start
|
||||||
|
|
|
@ -10,16 +10,13 @@ module Algorithms
|
||||||
# Step 5 − Repeat until list is sorted
|
# Step 5 − Repeat until list is sorted
|
||||||
|
|
||||||
a.each_with_index do |value, index|
|
a.each_with_index do |value, index|
|
||||||
# set current element as minimum
|
# set minimum to location
|
||||||
current_element = a[index]
|
min = a[index]
|
||||||
next_element = a[index + 1]
|
|
||||||
|
|
||||||
if next_element.nil? == false && current_element > next_element
|
|
||||||
puts "Current Element: #{current_element}"
|
|
||||||
puts "Next Element: #{next_element}"
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def insertion
|
def insertion
|
||||||
|
@ -43,4 +40,4 @@ module Algorithms
|
||||||
def bucket
|
def bucket
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Add table
Reference in a new issue