The thing about recursive functions:

I once tried to run a recursive Fibonacci sequence1 code2 with a relatively small3 number on my computer4 and I just had to take pity on my computer and make the program crash because the computer was starting to send out some weird messages and it just wasn’t stopping, the run.

Yeah, it gets ugly pretty quick. Lots of times it’s the easiest solution to code and it’s really very helpful but you really gotta know how to properly code them and, of course, when to use them.

1 0, 1, 1, 2, 3, 5, 8, 13 …
2 I mean, the code to solve the Fibonacci numbers from 1 to n.
3 “Relatively small” because the iterative version of the code did just fine with much bigger numbers.
4 My Asus EeePC 701 running Ubuntu 10.04, you can judge for yourself about the limits of it.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s