# Mitderm I Review

## Topics to be covered on Midterm I:

• Sets, relations, functions
• Regular Expressions and Regular Languages
• Deterministic Finite Automata
• Non-Deterministic Finite Automata
• Non-Regular Languages and the Pumping Lemma
• Context Free Grammars

## Book Sections to be covered on Midterm I

• Chatper 1, sections 1.1-1.8
• Chapter 2, sections 2.1-2.5
• Chapter 3, sections 3.1-3.2

## Sample Questions

1. For the language L = all strings over {a,b} that begin and end with aa
1. Give a regular expression for L
2. Give an NFA (DFA is OK too) for L
3. Give an NFA (DFA is OK too) for the complement of L
4. Give a regular expression for the complement of L
2. For the language L = all strings over {a,b} that contain the substring aa or bb
1. Give a regular expression for L
2. Give an NFA (DFA is OK too) for L
3. Give an NFA (DFA is OK too) for the complement of L
4. Give a regular expression for the complement of L
3. L = {w : w ∈ (a+b)*, |w| > 2 and one of the last three symbols in w is a 1}. So, 0010, 0111, 00100, 0101 ∈ L, but 01000 ∉ L
1. Give a Deterministic Finite Automaton for L
2. Give a regular expression for L
3. Give a regular expression for the complement of L
4. L = all strings over {a,b,c} that contain more a's than c's, and all a's appear before any c's. Thus, aababc, bbabac, aabbc ∈ L, but aca, babacc, and abc ∉ L
1. Give a Context-Free Grammar for L
2. Prove that L is not regular
5. Relations, partial orders, total orders
1. How many different relations R ⊆ A × A are there, in terms of |A|?
2. How many different total orders R ⊆ A × A are there, in terms of |A|?