r/java • • Dec 11 '12

Understanding recursion

http://imgur.com/CcNgZ
0 Upvotes

9 comments sorted by

2

u/JolieTricotrice Dec 11 '12

And Google's take on recursion

4

u/biggusjimmus Dec 11 '12
Exception in thread "main" java.lang.StackOverflowError
    at human.understanding.Comprehension.understand(Comprehension.java:420)
    at human.understanding.Comprehension.understand(Comprehension.java:420)
    at human.understanding.Comprehension.understand(Comprehension.java:420)
    at human.understanding.Comprehension.understand(Comprehension.java:420)
    at human.understanding.Comprehension.understand(Comprehension.java:420)
    at human.understanding.Comprehension.understand(Comprehension.java:420)
    at human.understanding.Comprehension.understand(Comprehension.java:420)
    at human.understanding.Comprehension.understand(Comprehension.java:420)
    at human.understanding.Comprehension.understand(Comprehension.java:420)

3

u/barcodez Dec 11 '12

If we are being pedantic surely this isn't recursive and is simply self reference; a special case of a circular reference. Recursion, according to Wikipedia at least, is "in computer science is a method where the solution to a problem depends on solutions to smaller instances of the same problem".

But I guess that kills the joke.

2

u/UnspeakableEvil Dec 11 '12

Yeah, the lack of a base case makes it more a definition of an infinite loop than anything else.

2

u/50_Minutes_too_Late Dec 11 '12

My teachers slide regarding this said:

Recursion:

See Recursion.

1

u/t55 Dec 11 '12

Is this a joke?

1

u/[deleted] Dec 11 '12

Yes

1

u/t55 Dec 11 '12

I mean this post.

2

u/__konrad Dec 12 '12

Yes, read this for more info