/
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. 09.07.2023 at 11:38 am / Non-Dissonant Speed Keybindings
  2. 31.07.2022 at 10:08 pm / Hades And (Non-Ending) Desk Jobs
  3. 07.04.2021 at 12:00 am / Harangued Commitments
  4. 11.02.2021 at 01:13 am / 46 Simple Python Exercises/#02
  5. 08.02.2016 at 12:00 am / Eye to Eye (Jonathan Young's Version)
  6. 16.10.2015 at 12:00 am / Don Ted E. Bear Waltz - Guitar Arrangement (Sam & Max)
  7. 06.10.2015 at 08:02 am / Subservient/Servile Written Malay
  8. 17.12.2014 at 12:00 am / 午・午年
  9. 11.11.2013 at 12:00 am / 下戸 - Lower House
  10. 16.08.2010 at 12:00 am / Lost Nuances in 'Ivan the Terrible'
© Wan Zafran. See disclaimer.