Mth to last – a recursive approach

Thursday, June 12th, 2008

A collegue of mine was pondering the mthToLast problem for a LinkedList I'd blogged about previously and sent me the following IM message: just a guess - but can you use recursion to solve your link list m problem? a method to track through the list which calls itself, then ...

Reverse a string using recursion

Thursday, June 12th, 2008

Very basic - take a string and reverse it using simple recursion. I'm sure there's a bunch of ways to do it, but like the fibonacci you should aim to be able to code something like the below in about 20 seconds... >>> def reverse(str): if len(str)==1: ...