csci3255 HW 3 - CSCI3255: Math Foundations of CS 3.1/1-11,...

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

View Full Document Right Arrow Icon
CSCI3255: Math Foundations of CS Homework Chapter 3, page 1 October 2002 3.1/1-11, 17, 18 1. Find all strings in L (( a + b )* b ( a + ab )*) of length less than four. Length 0: none, since there must be at least one b . Length 1: b Length 2: ab , bb , ba ( aa is not possible) Length 3: aab , aba , abb , baa , bab , bba , bbb . ( aaa is not possible) 2. Does the expression ((0+1)(0+1)*)*00(0+1)* denote the language of strings w such that w has at least one pair of consecutive zeros? This requires you to understand basic things about regular expressions. x x * represents one or more x ’s. So (0+1)(0+1)* represents items, each one of which is either a 0 or a 1. So this is all strings of zeros and ones of length 1 or greater. But when you apply * to this expression, you are now including λ making the expression ((0+1)(0+1)*)* the same as (0+1)*. So the expression as a whole represents any string that consists of 0’s and 1’s with a 00 somewhere in it. Therefore the answer to this question is YES. 3. Show that r = (1 + 01)*(0 + 1*) also denotes the language of strings w such that w has no pair of consecutive zeros. Find two other expressions for this language. It should be clear that (1 + 01)* forces every 0 to be followed by a 1, which is usually necessary for this language. The only exceptions are a 0 at the very end of the string, or any string that has no 0’s (all 1’s). So this expression DOES represent the language in question. Other possibilities might be (1 + 01)*(0 + λ ) + 1* or (1 + 01)* + (1 + 01)*0 + 1* 4. Find a regular expression for { a n b m : n ≥ 3, m is even}. n ≥ 3 can be represented by the expression ( aaa ) a* or, more, simply aaaa* and m is even can be represented by the expression ( bb )*. So, overall, the expression aaaa *( bb )* would represent this language. 5. Find a regular expression for { a n b m : ( n + m ) is even}.
Background image of page 1

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

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

This note was uploaded on 05/07/2010 for the course COMPUTER S 138 taught by Professor Icamarra during the Spring '10 term at UCLA.

Page1 / 5

csci3255 HW 3 - CSCI3255: Math Foundations of CS 3.1/1-11,...

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