working through some of Dan Gusfield's  "Algorithms on Strings, Trees and Sequences"