Skip to content

Instantly share code, notes, and snippets.

View pinkopaque22's full-sized avatar

Patricia Ehrhardt pinkopaque22

View GitHub Profile
@dogweather
dogweather / result
Last active January 6, 2016 21:28 — forked from gilomen2/result
Binary vs. Iterative search with a large data set
mercury:search-test robb$ ruby ./test.rb
user system total real
Binary search: 0.000000 0.000000 0.000000 ( 0.000016)
Iterative search: 0.000000 0.000000 0.000000 ( 0.004715)
Binary search: 0.000000 0.000000 0.000000 ( 0.000010)
Iterative search: 0.010000 0.000000 0.010000 ( 0.006112)
Binary search: 0.000000 0.000000 0.000000 ( 0.000016)
Iterative search: 0.010000 0.000000 0.010000 ( 0.010991)
@gilomen2
gilomen2 / truthiness.rb
Created September 10, 2015 21:01
Unexpected true/false behavior using defined?
THING = "thing_one"
puts THING
if defined? THING
puts "defined? THING is truthy"
else
puts "defined? THING is falsey"
end