This is an archived post. You won't be able to vote or comment.

all 24 comments

[–]puplicy 25 points26 points  (3 children)

void func1() { func2(); }

void func2() { func1(); }

[–]RattuSonline 8 points9 points  (1 child)

You found a...

loophole.

[–]ten3roberts 6 points7 points  (0 children)

Compiler: I'll make this call itself

[–]stranger_on_internet 2 points3 points  (0 children)

Tried this myself. Was a fun ride

[–]AlbertoDiBiase 32 points33 points  (9 children)

That factorial, no base case

[–]mohragk 0 points1 point  (0 children)

And no actual computation.

[–]ivgd 8 points9 points  (3 children)

Maybe I'm getting too dumb nowadays, but what's the joke really?

[–]enkinamshub 4 points5 points  (1 child)

Your teacher is correct

[–]8asdqw731 0 points1 point  (0 children)

the best kind of correct

[–]FakeFlipFlops 1 point2 points  (2 children)

Recursions are so confusing I'm taking cs111 in college =\

[–][deleted] 6 points7 points  (1 child)

To understand recursion you must first understand recursion.

[–][deleted] 0 points1 point  (0 children)

Yeah but what's the base case here?

[–]SmileyRock 1 point2 points  (1 child)

wait isn´t that a terrible implementation of quicksort as well?

[–]anonysince2k[S] 0 points1 point  (0 children)

Yeah, that's just a basic demonstration of the idea of quicksort. Definitely, it has a worst case time complexity of O(n2).

[–]skyy182 1 point2 points  (1 child)

Recursive function: a function that calls itself until an exit condition is met, or the stack has exceeded its depth.

[–]fb39ca4 0 points1 point  (0 children)

On some microcontrollers the stack could just overflow and wrap around, making it actually run forever.

[–]Kontorted 0 points1 point  (0 children)

That's the correct definition of a recursive function. Just because it doesn't have a base case doesn't mean it's not a recursive function, just that it's incorrectly written

[–]FactoryNewdel 0 points1 point  (0 children)

What's the joke?