hw_03_sol - Problem Set 3 Spring 10 Due: Thursday Feb 18 in...

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: Problem Set 3 Spring 10 Due: Thursday Feb 18 in class before the lecture. Please follow the homework format guidelines posted on the class web page: http://www.cs.uiuc.edu/class/sp10/cs373/ 1. [ Category : Comprehension, Points : 20] Give a regular expression for the following languages: (a) = { a,b } : The set of all strings where the second letter from the start and the end is an a . (b) = { a,b } : The set of all strings that have both aa and bb as a substring. (c) = { a,b,c } : The set of all strings, such that between any a and c there's at least one b . Describe the language of each of the following regular expressions in your own words. Please be speci c and try to minimize the amount of mathematical notation you use. (a) = { a,b } . ( ab + ba ) * (b) = { a,b } . (( a * ) b ( a * ) b ( a * )) * b (c) = { a,b,c } . (( + a + aa + aaa )( b + c )) * ( + a + aa + aaa ) Solution: Give a regular expression for the following languages: (a) = { a,b } : The set of all strings where the second letter from the start and the end is an a . Answer: ( a + b ) a ( a + b ) * a ( a + b ) (b) = { a,b } : The set of all strings that have both aa and bb as a substring. Answer: (( a + b ) * aa ( a + b ) * bb ( a + b ) * ) + (( a + b ) * bb ( a + b ) * aa ( a + b ) * ) (c) = { a,b,c } : The set of all strings, such that between any a and c there's at least one b . Answer: (( + aa * + cc * ) b ) * ( + aa * + cc * ) Describe the language of each of the following regular expressions in your own words. Please be speci c and try to minimize the amount of mathematical notation you use. (a) = { a,b } . ( ab + ba ) * Answer: The set of all strings of a s and b s that have an equal amount of a s and b s....
View Full Document

This note was uploaded on 09/19/2010 for the course CS 373 taught by Professor Viswanathan,m during the Spring '08 term at University of Illinois, Urbana Champaign.

Page1 / 4

hw_03_sol - Problem Set 3 Spring 10 Due: Thursday Feb 18 in...

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