Name:
Student ID:
CS181 Spring 2011 Problem Set 8
Due Friday, June 8th, 11am in box D1, BH2432
Please write your name and student ID in the
spaces provided then attach this sheet to the front
of your solutions.
Always explain your answers. Begin your
an
CS181 Winter 2016 - Problem Set 1 Solutions
1. (15 points). A Tierce NFA is a NFA that accepts a word w if there exist computation
paths for w such that more than one-third of the ending states are accepting. In this
question, we will study the equivalenc
CS 181 EXAM #3
SPRING 2015
NAME _
UCLA ID _
You have 90 minutes to complete this exam. You may assume without proof any statement
proved in class.
1
Consider the following context-free grammar:
S ! SS j T
T ! aT j aT b j ab j a:
(1 pts)
a. Describe the la
CS 181 FINAL EXAM
SPRING 2015
NAME _
UCLA ID _
You have 3 hours to complete this exam. You may assume without proof any statement proved
in class.
(2 pts)
1
Give a high-level description of a Turing machine that computes the function f W 1 ! 1 given
2
by
CS181 Spring 12 - (partial) Solutions to Problem Set 1
1. (a)
(b)
(c)
(d)
Counterexample: L1 = cfw_0, 1, L2 = cfw_1. Then (L1 L2 ) L1 = cfw_.
Counterexample: L = cfw_ . Then L = cfw_ . |L| = 1.
This is wrong as well: (L cfw_ ) , but L cfw_ .
/
Proof. Assu
HOMEWORK 5
1
Determine the equivalence classes of L for each of the following languages L:
a.
b.
c.
2
Use the Myhill-Nerode theorem to prove that the following languages are nonregular:
a.
b.
c.
3
L D fw W w begins with a 1 and ends with a 0g
L D fw W w c
CS 181 - Winter 2006 Formal Languages
Problem Set #5 Due February 20, 2008
Problem 4.1. (10 points) Recall the shuffle operator from Homework 2. Prove or disprove: a. Context free languages are closed under shuffle. b. Let L be context free and R r
CS181 Spring 12 - (partial) Solutions to Problem Set 5
1. Playing with CFGs (40 pts.)
(a) Give a CFG and provide a proof intuition for the language
L1 = cfw_0n 1m |n m + 2
Solution. The following CFG G1 works for L1 :
S 00BA
A 0A1 |
B 0B |
A proof involve
CS181 Spring 12 - (partial) Solutions to Problem Set 2
1. Formalizing DFSAs (20 pts.) Let LAP (n, m), n 0, m > 0 be the language
of strings over = cfw_a whose lengths are in an arithmetic progression. Formally,
LAP (n, m) = cfw_an+km | k 0. Give a formal
Solution to homework 3
1. A Regular Expression for addition! (30 pts.)
Solution.
We will construct a NFSA N that accepts ADD. N will have two states, one which remembers
that the carry bit is 1 while the other remembers that the carry bit is 0. When in st
Name:
Student ID:
Collaborators:
CS181 Winter 2015 Problem Set 5
Due Friday, March 6, 11:59pm
Please write your name, student ID, and the
names of anyone you collaborated with in
the spaces provided and attach this sheet to the
front of your solutions. I
Name:
Student ID:
Collaborators:
CS181 Winter 2015 Problem Set 4
Due Monday, February 23, 11:59pm
Please write your name, student ID, and the
names of anyone you collaborated with in
the spaces provided and attach this sheet to the
front of your solution
CS181 Winter 2017 - Problem Set 1 Solutions
1. (15 points). A Tierce NFA is a NFA that accepts a word w if there exist computation
paths for w such that more than one-third of the ending states are accepting. In this
question, we will study the equivalenc
HOMEWORK 5
1
Determine the equivalence classes of L for each of the following languages L:
a.
b.
c.
d.
e.
f.
2
W w begins with a 1 and ends with a 0g
W w contains at least three 1sg
W w contains 0101 as a substringg
W w has length at least 3 and its third
Name:
Student ID:
Collaborators:
CS181 Winter 2015 Problem Set 3
Due Monday, February 16, 11:59pm
Please write your name, student ID, and the
names of anyone you collaborated with in
the spaces provided and attach this sheet to the
front of your solution
Name:
Student ID:
Collaborators:
CS181 Winter 2015 Problem Set 2
Due Monday, February 2, 11:59pm
Please write your name, student ID, and the
names of anyone you collaborated with in
the spaces provided and attach this sheet to the
front of your solutions
CS 181A EXAM #2
SPRING 2014
NAME _
UCLA ID _
You have 90 minutes to complete this exam. You may assume without proof any statement
proved in class.
1
Find a regular expression for each of the following languages over f0; 1g:
(1 pt)
a. strings containing e
CS 181 FINAL EXAM
JUNE 10, 2013
You may assume without proof any statement proved in class or assigned as homework.
(4 pts)
(3
1
Let k be a xed positive integer. Construct the smallest possible DFA for the language
Lk D .0Y0k 1/ over the binary alphabet,
CS 181 A EXAM #3
SPRING 2014
NAME _
UCLA ID _
You have 90 minutes to complete this exam. You may assume without proof any statement
proved in class.
1
Give regular expressions for the languages generated by the following context-free grammars:
(2 pts)
a.
Name:
Student ID:
Collaborators:
CS181 Winter 2015 Problem Set 1
Due Friday, January 23, 11:59pm
Please write your name, student ID, and the
names of anyone you collaborated with in
the spaces provided and attach this sheet to the
front of your solutions
CS 181 B&C EXAM #3
SPRING 2014
NAME _
UCLA ID _
You have 90 minutes to complete this exam. You may assume without proof any statement
proved in class.
1
Give regular expressions for the languages generated by the following context-free grammars:
(2 pts)
a
CS 181 B&C EXAM #2
SPRING 2014
NAME _
UCLA ID _
You have 90 minutes to complete this exam. You may assume without proof any statement
proved in class.
1
Find a regular expression for each of the following languages over f0; 1g:
(1 pt)
a. strings containin
CS 181A EXAM #2
SPRING 2014
NAME _
UCLA ID _
You have 90 minutes to complete this exam. You may assume without proof any statement
proved in class.
1
Find a regular expression for each of the following languages over f0; 1g:
(1 pt)
a. strings containing e
CS181 Winter 2015 - Problem Set 1 Solutions
1. (10 points). Give a DFA for the language
L = cfw_x cfw_0, 1 | x interpreted as a binary number is divisible by 3.
As an example, the binary string 001011 translates to the decimal number 11 and is
thus not di
CS181 Winter 2015 - Problem Set 4 Solutions
1. (30 points) For this problem, we consider P DAs with multiple stacks.
(a) (15 points) Prove that a P DA with two stacks is strictly more powerful than a
P DA with one stack (i.e. two stack P DAs recognize a l
CS181 Winter 2015 - Problem Set #2 Solutions
1. (30 points) Prove that the following language is not regular without using pumping lemma
(but you can use the examples we showed in the class and the discussion section to be
irregular).
L = cfw_0a 1b : a, b
CS181 Winter 2015 - Problem Set #3 Solutions
1. (20 points) Consider a new binary operation
dened as follows: if A and B are
two languages, then A B = cfw_xy|x A, y B, and |x| = |y|. Give a proof sketch for
the following statement: If A and B are regular
MAY 1, 2013
MIDTERM EXAM
(4 pts)
1 Draw a deterministic nite automaton for the language of binary strings in which the
number of zeroes and the number of ones are both even.
(4 pts)
2 Draw a nondeterministic nite automaton for .0 Y 1/ 01.011 Y 0 / 11 :
(1
CS 181 EXAM #2
FALL 2015
NAME _
UCLA ID _
You have 90 minutes to complete this exam. You may assume without proof any statement
proved in class.
1
Give a regular expression for each of the following languages:
(2 pts)
a. strings of length at most 2015 ove
CS 181 EXAM #1
SPRING 2015
NAME _
UCLA ID _
You have 90 minutes to complete this exam. You may assume without proof any statement
proved in class.
(3 pts)
1
Give a simple verbal description of the language recognized by the following DFA.
1
1
0
1
0
0
0
0
Name:
Student ID:
CS181 Winter 2017 - Final
Due Friday, March 17, 7 PM
This exam is open-book and open-notes, but any materials not used in this course are prohibited,
including any material found on the internet. Collaboration is prohibited. Please avoi
CS181: Homework 2 solutions
Peter M. R. Rasmussen
February 3, 2017
1. (20 points) Let L1 and L2 be languages and define
shuffle(L1 , L2 ) = cfw_x1 y1 x2 y2 . . . xn yn | x1 . . . xn L1 , y1 . . . yn L2 .
(a) (10 points) Show that if the language L1 is not
CS181: Homework 5 solutions
Peter M. R. Rasmussen
March 14, 2017
1. (30 points). Let us define Fast-Rewind Turing Machines (FRTM). They are similar to
Turing Machines, except that the head of an FRTM is not allowed to move left one cell at a
time. Instead
CS181: Homework 4 solutions
Peter M. R. Rasmussen
February 22, 2017
1. (40 points).
(a) (15 points) Prove that
L1 = cfw_0a 1b | a divides b
is not context-free.
Solution: Assume for contradiction that L1 is context-free and let p be the pumping
2
length o
CS181: Homework 6 solutions
Peter M. R. Rasmussen
March 14, 2017
1. (20 points). Prove that the language
COMPLTM = cfw_hM1 , M2 i | L(M1 ) = L(M2 ), where M1 and M2 are Turing Machines
is not Turing-recognizable.
Solution. Suppose the language COMPLTM is