64.9k views
2 votes
let f(n) be the number of n digit strings, made from the characters a,c,t,g , that do not include the substring tag . what is the recurrence relation for f(n) ? a. f(n)

1 Answer

5 votes

Final answer:

To find the recurrence relation for f(n), we analyze cases based on the last characters of (n-1)-digit strings to ensure the 'tag' substring does not form when a new character is added, leading to a sum of different contributions based on strings ending with 'ta', 't', not 'ta', and not 't'.

Step-by-step explanation:

The student is asking for a recurrence relation for the function f(n), which denotes the number of n-digit strings made from the characters a, c, t, g that do not include the substring tag. To establish this recurrence relation, we must consider strings of length n ending in different characters and ensure that adding another character does not create the forbidden substring 'tag'.

Let's break the problem down:

  • An n-digit string not ending with 'ta' can be followed by any of the four characters, thus contributing 4*f(n-1) to f(n).
  • An n-digit string ending with 'a' but not with 'ta' can be safely followed by 'c', 'g', or another 'a' — contributing 3 times the number of (n-1)-strings ending with 'a' but not 'ta' to f(n).
  • An n-digit string ending with 't' but not 'ta' can be followed by 'c', 'g', or 'a' (which doesn't form the 'ta' at the end) — contributing 3 times the number of (n-1)-strings ending with 't,' but not 'ta,' to f(n).
  • For the n-digit strings already ending with 'ta,' we can only add 'c' or 'g,' not to form 'tag' — contributing 2 times the number of (n-1)-strings ending with 'ta' to f(n).

From these points, we derive a recurrence relation that accounts for all cases without creating the substring 'tag'. The detailed formation of this recurrence requires an understanding of combinatorial mathematics and careful enumeration of possibilities.

User Shane Miskin
by
8.6k points