Professional Documents
Culture Documents
2670HW1 Solutions
2670HW1 Solutions
(y − 1) > x
x<z<y
1
2. CSCI 2670 class has 48 students with the average score 79 in their final exam. Prove
(by contradiction) that there is at least one student with final exam score ≥ 79.
Proof:
Assume that the claim is not correct: none of the students achieves a final exam
score ≥ 79. That is, all students’ final exam scores are ≤ 78.
So the average of students’ final exam scores is
sum 48 × 78
avg = ≤ = 78
48 48
So the average is at most 78, contradicting to the given average 79. Therefore, the
assumption was incorrect and the claim is correct.
3. Let alphabet Σ = {0, 1}. Σ0 = {}, where is the special empty string with length
|| = 0, and, for integers k ≥ 1, Σk is defined with
Prove (by induction) that for every string w ∈ Σk , the length |w| = k.
Proof.
Base case: k = 0. Since Σ0 = {}, the only string in Σ0 is that has the length || = 0.
Assumption: For k ≥ 1, any string x ∈ Σk−1 has length |x| = k − 1.
Induction: Let w ∈ Σk , by the definition of Σk , w is a concatenation xy, where
x ∈ Σk−1 and y ∈ Σ. Then by assumption, we have
Answer:
abbaabbbabaa (rejected)
abaabbaabba (accepted)
babbbaba (accepted)
bbaabbaabb (rejected)
The FA accepts the set of strings, each containing at least two a’s and odd number of
b’s.
5. Question 1.3 on page 83 of the textbook (both 3rd edition and 2nd edition).
The formal description of a DFA M is
where δ function is given by the following table. Draw the state diagram of this
machine.
u d
q1 q1 q2
q2 q1 q3
q3 q2 q4
q4 q3 q5
q5 q4 q5
Answer: