|
To calculate the number of palindromes of length(2n), consider the following diagram,
which shows that there are as many palindromes of length 2n as there are the strings of length n i.e. the required number of palindromes are 2n.
which shows that there are as many palindromes of length 2n-1 as there are the strings of length n-1 i.e. the required number of palindromes are 2n-1.
Similarly the number of palindromes of length 2n-1, with ‘ b ’ as middle letter, will be 2n-1 as well. Hence the total number of palindromes of length 2n-1 will be 2n-1 + 2n-1 = 2 (2n-1)= 2n . | ||||
Previous | TOC | Next | ||