The useful algorithms pratice in ruby