IMPORTANT TIPS:
- If you have Prf. Shiri (as I did) be aware that at least a few exam questions will be taken directly or be very similar to questions from the assignments
- If you are writing too much, you are probably wrong. Many answers are one line or just a few words
- For questions that ask you to prove something about languages ALWAYS consider the following three languages and you will probably find a counterexample to what is being requested for proof:
- ∅
- {λ}
- Σ*
NOTES:
L1 & L2 are context free then:
- L1 ∪ L2 is context free
- L1L2 is context free
- L1* is context free
- L1 ∩ L2 is not necessarily context free
- ¬ L1 is not necessarily context free
Converting Right Linear grammar to Left Linear Grammar
- Draw FA from RL grammar
- Reverse it
- Get RL grammar of reverse
- Reverse the RHS of grammar to become LL grammar
Converting Left Linear grammar to Right Linear Grammar
- Reverse it to RL
- Draw FA
- Reverse FA
- Get RL grammar from the FA
Converting to Chomsky Normal Form steps:
- Get rid of all null productions
- Get rid of all productions where RHS is one variable
- Replace every production that is too long (i.e. X -> ABC) with shorter productions
- Move all terminals to productions where RHS in one terminal
RESOURCES:
Very clear course slides from U of San Francisco
Great slide about NFA to DFA Algorithm and the Transition table process HERE
Course page at Rensselear with many homeworks and solutions
Context Free Grammar Pumping Lemmas slides
Chomsky Normal Form conversion – clear steps from UC Davis
EXAMPLES:
Assignments and Solutions from previous COMP 335 with Prof. Shiri
Assignments and Solutions from previous COMP 335 with Prof. Grahne
- Assignment 1 and Solutions
- Assignment 2 and Solutions A and B
- Assignment 3 and Solutions
- Assignment 4 and Solutions
- and, Midterm Solutions (with Q’s)
From Cornell:
- Assignment + solutions on Regular Expressions
- Assignment + solutions on Context-Free Grammars
- Assignment + solutions on Context-Free Grammars
- Assignment + solutions on Push Down Automata
Example Questions on Regular and Non-Regular languages, from Harvard
Sample Midterm with great examples, from Standford
Midterm with Solutions from Worcester Polytechnic
Thank you ❤