Question: 5. Extra Credit. A coding system, called Cody, is made of 5 letters only, A, B, C, D. E. The letters A andE are called

 5. Extra Credit. A coding system, called Cody, is made of

5. Extra Credit. A coding system, called Cody, is made of 5 letters only, A, B, C, D. E. The letters A andE are called vowels, while the letters B, C and D are called consonants A sequence of letters is called a valid Cody word if no two vowels are adjacent and no two same letters are adjacent. For example, ABA is a Cody word, but AEC is not because the two vowels A and E are adjacent. Also AAB is not a Cody word because A and A are two same letters and adjacent. For any n letters long sequence using A, B, C, D, E the designer of Cody would like to know how many possible Cody words they can make. For example, for n=2 letters long sequence, there are 18 Cody words: AB. AC, AD, BA, BC. BD, BE, CA, CB, CD, CE, DA, DB, DC, DE, EB, EC, ED. Note that AE and EA are not Codv words (a) Write recurrence relations to determine the total number of Cody words of length n, provide reasoning (b) Write a program that takes n as the input and outputs the total number of Cody words. Run your program with n-5 and n-10 Hint: Let x(n) be the number of n letter Cody word ending with vowel letter, y(n) be the number of Cody wording ending with a consonant letter, and z(n) be the total Codv words

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!