algos in ruby