[Tutor] Bit Strings [a recursive approach / Herbert Wilf's
Algorithms and Complexity]
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Wed Oct 22 12:25:30 EDT 2003
> I guess I just didn't realize what I was doing by hand would have worked
> if I had coded it correctly. And, the nice thing about this is that it
> should be pretty easy to extend the idea if my strings need to have more
> characters. Just a few more base cases and the else:return needs to be
> have a few more lines. Thanks.
Hi Timothy,
Yes, the recursive approach generalizes easily beyond binary strings. So
you should be able to get this done well before the weekend. *grin*
> P.S. I guess it is the mathematician in me that doesn't like recursively
> defined functions. We tend to like closed form things better. And it
> was my stumbling block in my algorithm classes. Although, recursive is
> often much more elegant...
By the way, I just discovered that the mathematician Herbert Wilf has made
his book "Algorithms and Complexity", freely available from his web site!
http://www.cis.upenn.edu/%7Ewilf/AlgComp2.html
It's a nice 2**6 pages of quirky mathy goodness. Chapter 2 gives a talk
about recursive algorithms, so this is not totally off topic. *grin* I
wish I had seen it earlier, as well as his other book
"generatingfunctionology", which is also available off his web site.
More information about the Tutor
mailing list