Recurrence relationship for crawling a directory

44 Views Asked by At

I am trying to write a recurrence relationship for problems that can be solved using recurrence.

As an example recurrent for finding the 3^4 (which is 3*3*3*3) can be written as:

f(b,e) = 
{
   1 if n == 0,
   b if n == 1,
   b * f(b, n-1) n > 1
}

Where we define f(b ,e) be the value of b ^ e (b raised to the power of e)

Similarly, if a directory and files within it is written is given below like such:

apple:
   green
   red
   yellow

orange:
   big
   small
cow:
   animal

How can I write a recurrence relation equation for it? I have written a recursive program for it: https://github.com/pipa0979/PythonCode/blob/master/ProjectGoogle/Recursion/crawdirectory.py

I want to be able to write a recurrence equation to calculate the number of steps for crawling a directory.