reviwing ruby algorithms