November 7th, 2004, 01:01 AM
I'm Scared (... of recursion)
Oooo ya, it sounds nice and all, a simple little english word, recursion. It has got me really scared. I mean, what if i have a recursive function with no base cases and unlimited amounts of memory, it runs sure, but where does it end. WHERE I ASK YOU !, It just keeps on calling itself forever and ever and ever , who knows what could happen, what calcutions it could come up with. It could end the world.... Ahhhhh it's driving me mad.
For the sake of the children please, lets put an end to this recursive maddness.
Take a stand with me good people of antionline.com,
END RECURSION TODAY
END RECURSION TODAY
END RECURSION TODAY
November 7th, 2004, 01:44 AM
Definition: An algorithmic technique where a function, in order to accomplish a task, calls itself with some part of the task.
Specialization (... is a kind of me.)
tail recursion, collective recursion.
See also iteration, divide and conquer, divide and marriage before conquest, recursive, recurrence relation.
Note: Every recursive solution involves two major parts or cases, the second part having three components.
* base case(s), in which the problem is simple enough to be solved directly, and
* recursive case(s). A recursive case has three components:
1. divide the problem into one or more simpler or smaller parts of the problem,
2. call the function (recursively) on each part, and
3. combine the solutions of the parts into a solution for the problem.
Depending on the problem, any of these may be trivial or complex.
Edit> Also as just one example of recursive behavior is the Strange Loop:
From Wikipedia, the free encyclopedia.
A strange loop is a case of self-reference which affects (or even damages) the original item, possibly causing a paradox. For example, Abbie Hoffman once wrote a book called Steal This Book, which thereby tried to undermine its own sales in bookstores. The band System of a Down did the same later with the album Steal This Album!. The liar paradox and Russell's paradox also involve strange loops.
Strange loops often involve violation of hierarchies, in which (for example) a computer program (rather than a person) writes computer programs. This, by itself, is not enough to be a strange loop (it's merely self reference, and is common practice for a compiler). But it would be a strange loop if a program were to produce a new version of itself.
Strange loops are frequently intriguing or even humorous. A sketch on Late Night with Conan O'Brien once had Conan (seemingly spontaneously) become upset with a cue-card holder and tell him to leave the set; immediately, the cue-card holder was shown, holding a card with Conan's "you'd better leave" line written on it.
The concept of a strange loop was proposed and extensively discussed by Douglas Hofstadter in Gödel, Escher, Bach.
\"Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body, but rather to skid in sideways, Champagne in one hand - strawberries in the other, body thoroughly used up, totally worn out and screaming WOO HOO - What a Ride!\"
November 7th, 2004, 02:50 AM
Why should we support you?....................we know your type.............you would only go right out there and divide by zero
Whilst there is a similarity between the two problems, in the old days we had different solutions.
If you had a requirement for recursive processing you tackled it with sub-routines. Otherwise it wouldn't compile, or you got an error message when you ran the executable.
In the case of division by zero (which should produce infinity, so might be expected to take a little while) we would use an error message. In some statistical reports that is a valid answer so you would monitor for the error message and replace it with the "dead eight" symbol or "inf." if your font couldn't handle dead eight. Obviously we monitored for 0/0 and allowed that as "1" whch we usually printed as "-" to indicate a null value.
Nice of you to bring up problems we were dealing with 35 years ago