- #1
juki_inla
- 2
- 0
I am totally new to this area, and have some major trouble understanding how recurrence relations were derived from the problems, what to do and what's not. Really appreciate any guidance!For example: Give a Ternary String (containing only 0s, 1s, or 2s), we have to find out the recurrence relations of number of ternary string that contains 2 consecutive 0s.
Given solution:
String starting from 1--- an-1
String starting from 2--- an-1
=2*an-1
String starting from 01-- an-2
String starting from 02-- an-2
=2*an-2
String starting from 00-- an-2
=3n-2
an= 2*an-1 + 2*an-2+3n-2
My troubles are:
1) an-1. Can I safely understand it as the previous term we are working with before we get an
2) How do we derive these an-1, an-2 and so on? Until when/which previous terms should I stop?
3) Does that mean that anytime we use the previous terms, the initial condition [whether given or not] we have to assume it is true? For in this case, an-1
is working already with a ternary string of 2 consecutive zeros?
Thanks in advance!
Given solution:
String starting from 1--- an-1
String starting from 2--- an-1
=2*an-1
String starting from 01-- an-2
String starting from 02-- an-2
=2*an-2
String starting from 00-- an-2
=3n-2
an= 2*an-1 + 2*an-2+3n-2
My troubles are:
1) an-1. Can I safely understand it as the previous term we are working with before we get an
2) How do we derive these an-1, an-2 and so on? Until when/which previous terms should I stop?
3) Does that mean that anytime we use the previous terms, the initial condition [whether given or not] we have to assume it is true? For in this case, an-1
is working already with a ternary string of 2 consecutive zeros?
Thanks in advance!