There's a book, MASTERING ALGORITHMS WITH PERL, that I've used in the
past to refresh my memory on some basic algorithms from my college
CompSci days.  It's a very easy to read and understand book, and will
take you through all sorts of algorithms, including parsing trees,
doing sorts, etc.  Obviously, it's done in Perl, but that's not all
that different from Ruby, really.

-Augie