Assignment 3 Soln

# Assignment 3 Soln - MATH 239 Assignment 3 Solutions 1. Let...

This preview shows pages 1–2. Sign up to view the full content.

MATH 239 Assignment 3 Solutions 1. Let a and b be two distinct nonempty binary strings, and let A = { a, b } . Determine whether the following two statements are true or false, and prove your assertions. (a) If a and b have the same length, then strings of A * are uniquely created. (b) If a and b have different lengths, then strings of A * are uniquely created. Solution. (a) True. Suppose that a and b both have length k . Then A i is the set of strings that are concatenations of i strings of length k , so A i consists of all strings in A * that have length ik . Now let s be any string in A * . Since s has a ﬁxed length, there exists a unique n such that s A n . Then s = c 1 c 2 . . . c n where each c i is either a or b , but not both (since a 6 = b ). Therefore, s is uniquely created in A n , and hence uniquely created in A * . Alternate solution. Suppose that a and b both have length k . We will show that strings of A * are uniquely created by induction on the length of the string. Clearly ε is uniquely created. Let s be any nonempty string in A * . Then the ﬁrst k letters in s must be either a or b , but not both. So s = cd where c is uniquely deﬁned to be either a or b , and d A * . Since the length of d is shorter than s , d is uniquely created by induction. Therefore, s must be uniquely created. (b) False. Let a = 1 and b = 11 . Then the string 11 (which is in A * ) can be generated in two ways: aa and b . 2. For each of the three parts in this quesion, i. ﬁnd a decomposition that uniquely creates elements of S ; and ii. show that the generating function for S with respect to length is the given rational function. (a) i. S is the set of binary strings that do not contain “1000” as a substring. ii. Φ S ( x ) = 1 1 - 2 x + x 4 . Solution. (i) We start with { 0 } * ( { 1 }{ 0 } * ) * , which is a decomposition that uniquely creates every string of { 0 , 1 } * . Note that a binary string that does not contain “1000” as a substring is equivalent to a binary string having the property “following any 1, the subsequent string of 0’s has length at most 2.” Therefore, a decomposition that uniquely creates every string of S is { 0 } * ( { 1 }{ ε, 0 , 00 } ) * . (ii) First, we note that the generating function for

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 08/09/2009 for the course MATH 239 taught by Professor M.pei during the Spring '09 term at Waterloo.

### Page1 / 6

Assignment 3 Soln - MATH 239 Assignment 3 Solutions 1. Let...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online