Practicing algorithms using Ruby