Implementation of sort algorithms in ruby