Ruby implementations of common sorting and graph-related algorithms