/
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. 02.01.2024 at 08:16 pm / Go Interfaces - By Witcher-Like Metaphors
  2. 10.06.2022 at 07:44 pm / Teach Thy Tongue to Say: 'I Do Not Know'
  3. 07.10.2019 at 11:22 am / 3D & 2D - The Demarcation
  4. 31.12.2018 at 06:23 pm / Why Plain Text
  5. 12.07.2016 at 12:00 am / Refunctin' Blocks
  6. 12.03.2016 at 12:00 am / Transcript of Tifa Funk - Interlude Solo (Tifa's Theme by Tetrimino)
  7. 28.09.2015 at 12:00 am / Mocking the Law - Excessive Judicial Discretion
  8. 18.06.2015 at 12:00 am / Crisp Tweets
  9. 08.11.2013 at 12:00 am / Red Riding Hood's Examination-in-Chief
  10. 16.08.2010 at 12:00 am / You Have Reason
© Wan Zafran. See disclaimer.