top of page

Recursive Programming

Recursion is the computer concept that is closely related to While and For Loops. The key difference is that While and For Loops usually have an end condition of some kind such as X = 5. Recursion will only terminate when it has run out of data to process .

Lets look at an example of recursion:

The above code finds all directories and files below the stated path.

Note that the terminating condition for the loop is to run out of data and the fact that the data the program makes it uses . Making data and then using it in the same loop . The key point is that a nonrecursive algorithim could go only one subdirectory deep and then be forced to stop recrusive algorithims on the other hand can theoritically go on forever.

 

Recomendations

  1. Identify 2+ ways of using recursive algorithims

  2. Identify the key difference between Recursive and Nonrecursive algorithims

  3. Understand the termination condition of this Recursive program

  4. Modify the Recursive program in some way

Featured Posts
Check back soon
Once posts are published, you’ll see them here.
Recent Posts
Search By Tags
No tags yet.
bottom of page