Question: 2. Write a program that efficiently computes the number of strings of length n over {A, B, C} that have at least one occurrence of

2. Write a program that efficiently computes the number of strings of length n over {A, B, C} that have at least one occurrence of BAB and no occurrence of ACA. Your program should compute the values exactly for n up to 200 and run in less than 10 seconds. Run your program for n = 91 and include a screen shot the source code as well as the output. (Your code should also copied and pasted to the PDF document submitted.) Test case: The number of such strings for n = 27 is 2039428171297.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!