/
14.12.2018 at 03:09 pm
Cuttings

Recursion, Succinctly Put

The rules of recursion.

... There are 3 rules for recursion:

  1. A recursive algorithm must have a base case.

  2. A recursive algorithm must change its state and move toward the base case.

  3. A recursive algorithm must call itself, recursively.

A base case just means that it has an end point, something to stop it looping infinitely, such as when a particular variable reaches zero.

Changing its state means that through each iteration it gets closer to this variable.

Calling itself just means that you call the function that you're currently in with this new data to pass in.

- Reddit
Reference
Source: Reddit - Reference
Filed under:
#
Words: 7 words approx.
Time to read: 0.03 mins (at 250 wpm)
Keywords:
,

Other suggested posts

  1. 20.08.2020 at 08:59 pm / A Case for Legalese (Or Not)
  2. 29.01.2020 at 10:48 am / Code & Shame
  3. 15.12.2017 at 12:00 am / The Breakings of Julia
  4. 11.08.2015 at 12:00 am / Proper Denials and Bare Denials
  5. 23.07.2015 at 12:00 am / The Line Between Gifts and Bribes
  6. 16.01.2015 at 12:00 am / Ih Ah! (Devin Townsend)
  7. 29.11.2013 at 12:00 am / 勉強 - Straining Studious Strength
  8. 14.04.2012 at 12:00 am / Ghostly Portal
  9. 01.04.2012 at 12:00 am / Skipping Galaxies Over Coffee
  10. 14.08.2010 at 12:00 am / 豹変
© Wan Zafran. See disclaimer.