0

Suppose your alphabet is $\{A, C\}$. Every combination of letters is a word. How many words of length $N$ are there such that they do not have "ACA" as a substring?

It is required that the answer be in the form of a recurrence relation. My attempt so far is as follows:

Let $f_n$ be the number of words of length $n$ that satisfy the criteria above and $W_n$ any word of length $n$ satisfying the constraints. There are four cases:

Case 1: $\ $ $W_{n-1}$ ends in 'A' and $W_{n-2}$ ends in 'A'

Here, $W(n)$ can be either 'A' or 'C'. So $f_n = 2f_{n-1}$

Case 2: $\ $ $W_{n-1}$ ends in 'A' and $W_{n-2}$ ends in 'C'

Here, $W(n)$ can be either 'A' or 'C'. So $f_n = 2f_{n-1}$

Case 3: $\ $ $W_{n-1}$ ends in 'C' and $W_{n-2}$ ends in 'A'

We have $f_n = f_{n-1}$ (since $W(n)$ can only be 'C')

Case 4: $\ $ $W_{n-1}$ ends in 'C' and $W_{n-2}$ ends in 'C'

Yet again we have $W(n) = 2f_{n-1}$

I am not sure if the recurrence relation I drew is correct. I also don't know how to solve this piecewise recurrence relation to get a function of $N$. So, I am posting this as a question. Can someone validate my attempt and complete my solution?

Many thanks in advance...

0 Answers0