Question

For integer n ≥ 1, let h(n) be the number of length n words consisting of...

For integer n ≥ 1, let h(n) be the number of length n words consisting of A’s and B’s, that contain either at least an “AA”, or at least an “ABB”. Find a recurrence relation satisfied by h(n) (with necessary initial conditions) and solve it. (Previous answers to this question have been incorrect)

Homework Answers

Answer #1

ANSWER:

For integer n ≥ 1, let h(n) be the number of length n words consisting of A’s and B’s

Let h(n) be such no of length n words.

There are 3 cases

Case 1- word starts with B ,then h(n) will be h(n-1)

Case 2-word starts with AA then all remaining n-2 length words will be accepted which is 2n-2 .

Case 3-word starts with AB Here ther are 2 cases

Case 3.a- word starts with ABB then n-3 length words will be accepted which is 2n-3

Case 3.b- word starts with ABA then h(n) will be h(n-2) because third character of this string is A,So valid string can also be started from this third character.

So recurrence relation will be

h(n) = h(n-1) + h(n-2) + 2n-2 + 2n-3

Here base case is

h(0)=0

h(1)=0 (which means that length of 0 and 1 words that satisfy above condition is zero).

h(2)=1 and so on.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
(a) Find a recurrence relation for the number of bit strings of length n that contain...
(a) Find a recurrence relation for the number of bit strings of length n that contain the substring 10. (b) What are the initial conditions? (c) How many bit strings of length seven (i.e. a7) contain the substring 10?
3))Find a recurrence relation for the number of ternary strings of length ? ≥ 1 that...
3))Find a recurrence relation for the number of ternary strings of length ? ≥ 1 that contain at least two 0s. What are the initial conditions?
Let an, for n≥1, be the number of strings of length n over {0,1,2,3}, allowing repetitions,...
Let an, for n≥1, be the number of strings of length n over {0,1,2,3}, allowing repetitions, suchthat no string contains a 3 to the right of a 0. Find a recurrence relation and initial condition(s) for an.
Let hn be the number of ways to cover a 1 × n board using only...
Let hn be the number of ways to cover a 1 × n board using only 1 × 1 tiles, red or blue 3 × 1 tiles, red, blue, or green 4 × 1 tiles, and 5 × 1 tiles. Find a recurrence relation for hn along with enough enough initial conditions to allow one to compute the entire sequence.
1.A fair die is rolled once, and the number score is noted. Let the random variable...
1.A fair die is rolled once, and the number score is noted. Let the random variable X be twice this score. Define the variable Y to be zero if an odd number appears and X otherwise. By finding the probability mass function in each case, find the expectation of the following random variables: Please answer to 3 decimal places. Part a)X Part b)Y Part c)X+Y Part d)XY ——- 2.To examine the effectiveness of its four annual advertising promotions, a mail...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT