Fundamental algorithms implemented in Ruby