How can I find a recursive relation for the following words?

70 Views Asked by At

if c(n) is the number of words created by the alphabet {a,b,c} with n length that the word does not contain 'ab' term then write a recursive relation for c(n).

I don't have enough knowledge of the recursive relations but I have tried guessing the relation.

1

There are 1 best solutions below

0
On BEST ANSWER

I guess since the comment wasn't enough, I'll explain it. To form a valid word of length $n$, take a valid word of length $n-1$ and append an a, b, or c. The problem is some of those new words will now end in ab. However, the first $n-2$ characters of such words will not contain ab, so we created $c(n-2)$ invalid combinations, which can simply be subtracted out.