A palindrome is a string whose reverse is identical to the original string. Give examples of bit strings of length 5 and 6 that are palindromes. How many bit string palindromes of length n are there? How many ternary string palindromes of length n are there?

Respuesta :

Answer:

The answers to the question are as follows

a). Please see the examples of bit strings of length 5 and 6 that are palindromes in the following explanation.

b). The number of even length palindromes is [tex]26^{\frac{n}{2} }[/tex]

The number of odd length palindromes is [tex]26^{\frac{n+1}{2} }[/tex]

c). The number of  ternary string palindromes of length n is 702.

Step-by-step explanation:

a). Examples of bit strings of length 5 and 6 that are palindromes are

Bit strings of length 5                                 Bit strings of length 6

Kayak                                                           Hannah

Level                                                            Redder

Civic                                                             Terret

Madam                                                         Kakkak

Solos                                                            degged

Tenet

Rotor

Minim

Radar

Refer

Terret

b). When n is even, we have a choice of any of the 26 characters for the first letter, similarly, we can choose any character for the second, and so on up till the n/2 th position after which subsequent letters depend on the letter chosen before the half point following the definition of a palindrome.

Therefore we have n/2 independent choices with repetition therefore we have [tex]26^{\frac{n}{2} }[/tex] palindromes of even length with or without meaning in the alphabet

On the other hand, when n is odd, we are free to chose any letter up to the middle letter as before this means we have [tex]\frac{n-1}{2} +1 = \frac{n+1}{2}[/tex] free choices

Therefore the number of odd length palindromes are [tex]26^{\frac{n+1}{2} }[/tex]

c). For a ternary string palindrome, we have 26 letters for the first position, and also 26 for the second, while the third is the same as the first which is one option.

Where n = 2 we have 26 ways of selecting the first and second letters which are equal

Therefore the number of  ternary string palindromes of length n  are 26×26 + 26 = 702