added a boolean algebra file

This commit is contained in:
booboy 2019-05-06 23:41:08 -05:00
parent 8891f1c975
commit 3943d0c8f2
3 changed files with 27 additions and 5 deletions

View file

@ -1,5 +1,6 @@
require "algorithms/version" require "algorithms/version"
require "algorithms/sorting" require "algorithms/sorting"
require "algorithms/boolean_algebra"
module Algorithms module Algorithms
class Error < StandardError; end class Error < StandardError; end

View file

@ -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

View file

@ -9,13 +9,13 @@ module Algorithms
# Step 4 Increment MIN to point to next element # Step 4 Increment MIN to point to next element
# Step 5 Repeat until list is sorted # Step 5 Repeat until list is sorted
a.each_with_index do |value, index| counter = 0
# set minimum to location max = a.length
min = a[index]
a.map do |item|
#binding.pry
counter += 1
end end
end
end end