Skip to content

Instantly share code, notes, and snippets.

View evanson's full-sized avatar

Evanson Wachira evanson

View GitHub Profile
@nathanl
nathanl / traveling_salesman_brute_force_time.rb
Created February 21, 2015 13:08
How long it takes to solve the Traveling Salesman problem by brute force
def factorial(n)
(1..n).reduce(:*)
end
SECONDS_PER_STEP = 0.001
def total_seconds(n)
factorial(n) * SECONDS_PER_STEP
end