Data structures and algorithms in Ruby