I don't quite understand the "Zero-pair free binary strings" example given in class on Oct. 1st. It says:
def zpf(n):
if n == 0: #return the number of empty BS that do not have pairs of adjacent zeros.
if n == 1: #return the number of length one BS that do not have pairs of adjacent zeros.
else: #how many strings of length n, in terms of n - 1 and n - 2?
What does the last sentence mean? Does it mean that the strings of length n equals can be represented by the strings of length (n - 1) and (n - 2)? If so, how?
The example we had in class was:
00 and 10 in terms of n - 2
01 and 11 in terms of n - 1
That's even more confusing. Does it mean that if the string has length n ends with 00 or 10, the number of zero-free pairs equals that has a length (n - 2), and same argument for strings ends with 01 or 11? If so, why this is true?
I guess I'll look through the textbook to see if there is a solution to my question.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment