/
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

Filed under:
#
Words: 103 words approx.
Time to read: 0.41 mins (at 250 wpm)
Keywords:
, , , , , , , , ,

Other suggested posts

  1. 29.11.2023 at 11:04 pm / Of Witchers By Trade
  2. 15.10.2023 at 01:01 pm / Sunset-Rowing Witchers
  3. 18.06.2022 at 06:52 pm / Strangling Deeds
  4. 13.08.2020 at 10:00 am / Consenting Pythonic Adults
  5. 27.04.2020 at 07:11 pm / How Science Should Be
  6. 05.02.2020 at 10:26 pm / Nostalgic Raging Streets
  7. 16.12.2017 at 12:00 am / Sketch, Draft, Craft
  8. 12.12.2017 at 12:00 am / Innocent Until Proven Guilty
  9. 15.08.2010 at 12:00 am / 海老
  10. 14.08.2010 at 12:00 am / Basic Kanji Learning Principles
© Wan Zafran. See disclaimer.