Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Recursion is shit.

Name: Anonymous 2011-12-10 2:12

Unless you want your programs to segfault, then it's okay.

Name: Anonymous 2011-12-10 17:48

>>20
And later on in the same chapter...

"When n is 1, countDown displays 1. This is the base case and requires constant amount of time. When n > 1, the method requires a constant amoutn of time for both the println statement and the comparison. In addtion, it needs time to solve the smaller problem represented by the recursive call. If we let O(n) represent the time for countdown(n), we can express these observations by writing

  t(1)
  t(n) = 1 + t(n -1) for n > 1

  The equation for O(n) is called a recurrence relation."

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List