midterm_review_v2.pdf

# Your program must use labels where possible b what

• Notes
• 5

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

Your program must use labels where possible. (b) What does the program do? 4 Regular Languages Note that for simplicity, leading zeroes are allowed. 1. Prove that the language L = { A, B, C, D } is regular. 2. Give a DFA for each of the following languages: (a) The language L over Σ = { g, o, e, s } which contains words similar to goose or geese : with 1 or more o ’s, e ’s respectively between the g and the s. For example, goose , gese and geeeeeese are words in the language, but gse and goese are not. (b) The language L over Σ = Γ ∪{ + } , where Γ = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } , such that: L = { u + v : u, v Γ * , u 0 (mod2) and v 1 (mod2) } In words, language L contains all addition expression with exactly two operands whose first operand is an even decimal number and the second operand is an odd decimal number. (c) Exercise. The language L over Σ = { 0 , 1 } which contains strings with a binary value that is congruent to 3 modulo 8. (That is, the binary value of string x divided by 8 gives a remainder of 3). Hint: Think about the 3 least-significant (rightmost) bits. 3. Give a regular expression for each of the following languages: (a) The language L over Σ = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } of positive decimal numbers divisible by 4. 3

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

(b) the language L over Σ = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , a, b, c, d, e, f, .word, x, } of valid MIPS .word directives with positive decimal and all hexadec- imal arguments. (Use to represent a space) 4. You are given a regular language L and a NFA M ( L ) = { Σ , Q, q 0 , A, δ } for the language. In pseudocode, write a function that takes a string s Σ * as an argument. The function returns 1 if the string is in language L , return 0 otherwise.
This is the end of the preview. Sign up to access the rest of the document.
• Fall '09
• TroyVasiga
• Binary numeral system, Regular expression, MIPS assembly language program

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern