GATE CSE
First time here? Checkout the FAQ!
x
+2 votes
236 views

A palindrome is a string whose reversal is identical to the string. How many bit strings of length n are palindromes?

  1.   2⌈n⁄2⌉
  2.   2(⌊ n/2⌋ )
  3.   2⌈n⁄2⌉ -1
  4.   2(⌊ n/2⌋) -1
asked in Combinatory by Veteran (13.2k points)  
retagged by | 236 views

2 Answers

+3 votes

Try with N= 2 you get aa,bb 2⌈n⁄2⌉  = 2

Try with N= 3 you get aaa,bbb ,aba , bab  2⌈n⁄2⌉  = 4

Try with N= 4 you get aaaa,bbbb ,abba , baab , 2⌈n⁄2⌉  = 4

A is answer

answered by Veteran (47.9k points)  
0 votes

The trick here is to realize that a palindrome of length n is completely determined by its first ceiling(n/2)  bits.
This is true because once these bits are specified, the remaining bits, read from right to left, must be identical
to the first floor(n/2) bits, read from left to right. Furthermore, these first ceiling(n/2) bits can be specified at will,
and by the product rule, there are 2^ceiling(n/2) ways to do so. Hence answer is 2^ceiling(n/2)--> Option (A)

answered by (201 points)  

Related questions

+2 votes
1 answer
1
+2 votes
1 answer
2


Top Users Jul 2017
  1. Bikram

    3946 Points

  2. manu00x

    2464 Points

  3. Debashish Deka

    1842 Points

  4. joshi_nitish

    1650 Points

  5. Arjun

    1268 Points

  6. Hemant Parihar

    1184 Points

  7. Arnab Bhadra

    1100 Points

  8. Shubhanshu

    1052 Points

  9. Ahwan

    900 Points

  10. rahul sharma 5

    692 Points


24,016 questions
30,946 answers
70,303 comments
29,332 users