Ruby implementations of common algorithms