Popular algorithms implemented in ruby