add ruby implementation of lecture 9 algorithms