Recurrence relation for algorithm that has 2 different recursive calls

286 Views Asked by At

Doing a problem on my HW, don't want to get too specific to avoid cheating.

When the algorithm calls itself there are two options

if (statement)
  return 1 + functionCall
else
  functionCall

So I'm writing the recurrence relation

If the statement is true then: T(n) = 1 + T(n-1)

Else: T(n) = T(n-1)

How do I write the recurrence relation if it's always different? do I just use a variable as a const? So it would be T(n) = c + T(n-1)?