Programming Techniques


Before giving any formal definition of Recursion, I will like to discuss a scenario...

Browing your files on local disk is a very common task. Let us assume you have to write a procedure that performs an action (like calculating the size) on every file on your C:
The algorithm will be something like follows:

Apply the action on all files in the root directory. Then pick up its sub-diectory & apply the action on all its files. Then pick up the sub-sub directory & continue the procedure until there's no more nested sub-directories.