reshown by
1,639 views
1 votes
1 votes

The recurrence relation for the number of n-digit quaternary sequences that have an even number of zeros (quaternary sequences use only 0,1,2,3 for digits) is-

(A) an = an-1 + 4n-1

(B) an = 3an-1 + 4n-1

(C) an = 2an-1 + 4n-1

(D) an = an-1 + 4n-2

reshown by

2 Answers

Best answer
4 votes
4 votes
Ok, C is correct , you can check by calulcating some values.

f[1] = 3 ,     { 1  , 2 , 3  }

f[2] = 10    , { 00 , 11 , 12, 13 , 21 , 22 , 23 , 31 ,32 , 33 }

f[3] =  36  

No zero total number =  3 ^ 3 =  27

Two zero   =  9  {   100 , 200 , 300 , 010 , 020 , 030 , 001, 002, 003 }  

Hence C is correct  :   f(n) = 2 * f(n-1) + 4 ^ (n - 1 )   

Also F(n)  =   C(n,0) * 3^n   + C(n,2) * 3^(n - 2 )   +  C(n,4) * 3 ^ ( n - 4 )   + .......      C(n,r)  * 3 ^(n - r )    

Because , either you used 0 times 0 , 2 times 0  , 4 times 0     .....
selected by
4 votes
4 votes

an = 2an-1 + 4n-1

Case 1: nth place occupied by 1/2/3, then no of solutions = 3*an-1

Case 2: nth place occupied by 0, then the string a[1:n-1] should have odd number of 0s.

We know an-1 = string of length n-1 with even 0s.

Total string of length n-1 = 4n-1

Thus, string of length n-1 with odd number of 0s = 4n-1 an-1

=> an = 3*an-1 + 4n-1 - an-1 

=> an = 2an-1 + 4n-1

Related questions

22 votes
22 votes
1 answer
1
P C asked Dec 31, 2022
1,656 views
What is the recurrence relation for the ternary strings of length $n$ which can be constructed using 0,1 or 2 only such that the number of 0’s and number of 1's is od...
1 votes
1 votes
2 answers
2
aditi19 asked May 14, 2019
878 views
What will be solution of recurrence relation if roots are like this: r1=-2, r2=2, r3=-2, r4=2is this the case of repetitive roots?
0 votes
0 votes
0 answers
3
0 votes
0 votes
0 answers
4
aditi19 asked May 13, 2019
674 views
Consider the nonhomogeneous linear recurrence relation $a_n$=$3a_{n-1}$+$2^n$in the book solution is given $a_n$=$-2^{n+1}$but I’m getting $a_n$=$3^{n+1}-2^{n+1}$