some algorithms in ruby