quiz1-solutions-Spring-2007

quiz1-solutions-Spring-2007 - CS 360: Introduction to the...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 360: Introduction to the Theory of Computing John Watrous, University of Waterloo Solutions to Quiz 1 1. [10 points] Consider the following language: A = { w { 0, 1 } : w represents a number in binary notation that is divisible by 3 } . For example 100111 represents the number 39 in binary, so because 39 is divisible by 3 we have 100111 A . On the other hand, 10011 represents the number 19 in binary, which is not divisible by 3, and so 10011 negationslash A . The string 0 represents the number 0 in binary, so 0 A . However, any other string starting with 0, such as 011, should be assumed to not be contained in A , because it is not a proper binary representation of a number. Along similar lines, negationslash A . Give a DFA that recognizes A . Solution. Here is a DFA that recognizes A : q q 1 q 2 r r 1 r 2 1 0, 1 0, 1 1 1 1 You were not required to explain why or how your DFA works. For an explanation of why the DFA above works, see the homework 1 problem 7 solutions for a similar (but more complicated) version of the problem. Common mistakes. Most people had a good idea about how to do this one, given the similarity to problem 7 on the homework. Some people made small mistakes in calculating remainders, possibly due to time pressure....
View Full Document

This note was uploaded on 09/22/2011 for the course CS 360 taught by Professor Johnwatrous during the Spring '08 term at Waterloo.

Page1 / 3

quiz1-solutions-Spring-2007 - CS 360: Introduction to the...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online