Cs381-fall02-prelim1 - CS381 Fall 2002 First Mid Term Monday Oct 7 2002 Olin 155 9:05-9;55 This is a 50 minute in class closed book exam All

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

View Full Document Right Arrow Icon
CS381 First Mid Term Monday Oct 7, 2002 Fall 2002 Olin 155 9:05-9;55 This is a 50 minute in class closed book exam. All questions are straight forward and you should have no trouble doing them. Please show all work and write legibly. Thank you. 1. Write a regular expression for the set of all strings of 0’s and 1’s such that the number of occurrences of the substring 01 is even. Zero occurrences is even. Argue in English that your regular expression is correct. 1*(0* (01)1*0*(01)1*)*0*, or more concisely, 1*(0 + 1 + 0 + 1 + )*0*. Note that, in this expression, all occurrences of the substring 01 come from within the inner expression, 0 + 1 + 0 + 1 + , since repeating this expression, or preceeding it by a string of 1’s, or following it by a string of 0’s does not create any additional occurrences of 01. Furthermore, this inner expression contains exactly 2 occurrences of 01. Starring this expression allows any even number and only even numbers of occurrences of 01 to appear. Finally, we allow all possible strings not containing the substring 01, i.e. 1*0*, between any two occurrences of 01, before the first occurrence, and after the last
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/19/2008 for the course COM S 381 taught by Professor Hopcroft during the Fall '05 term at Cornell University (Engineering School).

Page1 / 3

Cs381-fall02-prelim1 - CS381 Fall 2002 First Mid Term Monday Oct 7 2002 Olin 155 9:05-9;55 This is a 50 minute in class closed book exam All

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