diff --git a/algorithms/lib/algorithms.rb b/algorithms/lib/algorithms.rb index 3ac1a5f..b2e14fc 100644 --- a/algorithms/lib/algorithms.rb +++ b/algorithms/lib/algorithms.rb @@ -1,5 +1,6 @@ require "algorithms/version" require "algorithms/sorting" +require "algorithms/boolean_algebra" module Algorithms class Error < StandardError; end diff --git a/algorithms/lib/algorithms/boolean_algebra.rb b/algorithms/lib/algorithms/boolean_algebra.rb new file mode 100644 index 0000000..c2692a1 --- /dev/null +++ b/algorithms/lib/algorithms/boolean_algebra.rb @@ -0,0 +1,21 @@ +module Algorithms + class BooleanAlgebra + def multiplication_table +<<-TABLE +0.0 = 0 +0.1 = 0 +1.0 = 0 +1.1 = 1 +TABLE + end + + def addition_table +<<-TABLE +0+0 = 0 +0+1 = 1 +1+0 = 1 +1+1 = 1 +TABLE + end + end +end \ No newline at end of file diff --git a/algorithms/lib/algorithms/sorting.rb b/algorithms/lib/algorithms/sorting.rb index b0ba266..446839f 100644 --- a/algorithms/lib/algorithms/sorting.rb +++ b/algorithms/lib/algorithms/sorting.rb @@ -9,13 +9,13 @@ module Algorithms # Step 4 − Increment MIN to point to next element # Step 5 − Repeat until list is sorted - a.each_with_index do |value, index| - # set minimum to location - min = a[index] - + counter = 0 + max = a.length + a.map do |item| + #binding.pry + counter += 1 end - end end