Algorithms implemented in Ruby