{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

MIT6_042JF10_mid_pctce_sol

# MIT6_042JF10_mid_pctce_sol - 6.042/18.062J Mathematics for...

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

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.

Unformatted text preview: 6.042/18.062J Mathematics for Computer Science October 21, 2010 Tom Leighton, Marten van Dijk, and Brooke Cowan Midterm Practice Problems Problem 1. [10 points] In problem set 1 you showed that the nand operator by itself can be used to write equivalent expressions for all other Boolean logical operators. We call such an operator universal . Another universal operator is nor , defined such that P nor Q ( P ∨ Q ). ⇔ ¬ Show how to express P ∧ Q in terms of: nor , P , Q , and grouping parentheses. Solution. ( P ) nor ( Q ) = ( P nor P ) nor ( Q nor Q ). ¬ ¬ Problem 2. [15 points] We define the sequence of numbers 1 if 0 ≤ n ≤ 3, a n = a n − 1 + a n − 2 + a n − 3 + a n − 4 if n ≥ 4. Prove that a n ≡ 1 (mod 3) for all n ≥ 0. Solution. Proof by strong induction. Let P ( n ) be the predicate that a n ≡ 1 (mod 3). Base case: For ≤ n ≤ 3, a n = 1 and is therefore ≡ 1 (mod 3). Inductive step: For n ≥ 4, assume P ( k ) for ≤ k ≤ n in order to prove P ( n + 1). In particular, since each of a n − 4 , a n − 3 , a n − 2 and a n − 1 is ≡ 1 (mod 3), their sum must be ≡ 4 ≡ 1 (mod 3). Therefore, a n ≡ 1 (mod 3) and P ( n + 1) holds. Problem 3. [20 points] The Slipped Disc Puzzle consists of a track holding 9 circular tiles. In the middle is a disc that can slide left and right and rotate 180 ◦ to change the positions of exactly four tiles. As shown below, there are three ways to manipulate the puzzle: Shift Right: The center disc is moved one unit to the right (if there is space) Rotate Disc: The four tiles in the center disc are reversed Shift Left: The center disc is moved one unit to the left (if there is space) 2 Midterm Practice Problems s h if t r ig h t rotate disc s h if t le f t 1 2 3 4 5 6 7 8 9 1 2 6 5 4 3 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 Prove that if the puzzle starts in an initial state with all but tiles 1 and 2 in their natural order, then it is impossible to reach a goal state where all the tiles are in their natural order....
View Full Document

{[ snackBarMessage ]}

### Page1 / 10

MIT6_042JF10_mid_pctce_sol - 6.042/18.062J Mathematics for...

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

View Full Document
Ask a homework question - tutors are online