A ternary string is a string character from the set 012 Recu
A ternary string is a string character from the set {0,1,2}. Recursivley define the set of ternary strings with no consecutive 0\'s.
Solution
The a recurrence relation for the number of ternary strings of length n that contain a pair of consecutive 0\'s is:
an =2an?1 +2an-2a n?2 +3n?2
and
The a recurrence relation for the number of ternary strings of length n that contain a pair of no consecutive 0\'s is:
i,e The number bn of ternary strings of length n that do not contain the substring 00 is actually
bn=3n-an
=3n-(2an?1 +2an-2a n?2 +3n?2)
=3n ?(2(3n?1 ?bn?1 )+2(3n?2 ?bn?2 )+3n?2 )
=3n ?(2.3n?1+2.3n?2 ?2.bn?1 ?2.bn?2
=2bn-1+2bn-2.
=3 n ?(2?3 n?1 +3?3 n?2 ?2b n?1 ?2b n?2 )=2b n?1 +2b n?2 .
