DEPT. OF COMPUTER SCIENCE, UNIVERSITY OF CALIFORNIA, DAVIS
ECSIZO, WINTER 2015 INSTRUCTOR: ROB GYSEL
Midterm #1
January 30th, 2015
Name: So\ Vii—t on; Student ID:
' Do not open the midterm until instructed to do so.
 You 50 minutes to complete your t
ECS122A Homework Assignment #3
Due: 4:00pm, February 5, 2014
1. What does the algorithm FindMaxSubarray1 returns when all elements of the array A are negative?
2. Write a pseudocode for the bruteforce method of solving the maximumsubarray problem. Your
ECS 120: Theory of Computation
UC Davis Phillip Rogaway
ps2soln
April 11, 2014
Problem Set 2 Solutions
Problem 1 Draw DFAs for the following languages:
(a) A = cfw_x cfw_a, b : x 3
(b) B = the binary encodings of numbers divisible by 7. Allow leading z
ECS 120: Theory of Computation
UC Davis Phillip Rogaway
ps1soln
April 3, 2015
Problem Set 1 Solutions
Problem 1 Call a number x N = cfw_1, 2, 3, . . . a palindromic number if, written as a decimal string
X without leading zeros, its a palindrome (X = X R
ECS 120: Theory of Computation
UC Davis Phillip Rogaway
Handout ps4
January 31, 2012
Problem Set 4 Due Tuesday, February 7, 2012
Problem 1. Are the following statements true or false? Either prove the statement or give a simple
counterexample.
(a) If L L
ECS 120: Theory of Computation
UC Davis Phillip Rogaway
ps4soln
April 25, 2014
Problem Set 4 Solutions
Problem 1.
(a) Using the procedure shown in class, convert NFA into a regular expression for the same language.
b
a
0
1
2
c
b,c
c
(b) Using the procedu
ECS 122A: Introduction to Algorithms
UC Davis Vladimir Filkov
May 13, 2012
Problem Set 5 (v2.0: full)
Due: May 21 at 3:15 pm in 2131 Kemper
Exercises from text (dont submit): 5.33, 5.35b, 5.40, 5.48, 5.51, 5.57, 5.59, 5.61, 5.68, 6.11, 6.12, 6.31.
Problem
ECS 120: Theory of Computation
UC Davis Phillip Rogaway
ps2
April 4, 2014
Problem Set 2 Due Friday, April 11, 2013
Problem 1 Draw DFAs for the following languages:
(a) A = cfw_x cfw_a, b : x 3
(b) B = the binary encodings of numbers divisible by 7. Allo
ECS 122A: Introduction to Algorithms
UC Davis Vladimir Filkov
May 22, 2012
Problem Set 6
Due May 29 at 3:15 pm in 2131 Kemper
Exercises from the text (do not submit): 7.1, 7.2, 7.3, 7.6, 7.13, 7.16, 7.17, 7.18, 7.21, 7.22, 7.24, 7.26,
7.27, 7.31, 7.32, 7.
ECS 122A: Introduction to Algorithms
UC Davis Vladimir Filkov
May 22, 2012
Problem Set 5 Solutions
Exercises from text (dont submit): 5.33, 5.35b, 5.40, 5.48, 5.51, 5.57, 5.59, 5.61, 5.68, 6.11, 6.12, 6.31.
Problems (140):
(12) Problem 1. How many zeros d
ECS 120: Theory of Computation
UC Davis Phillip Rogaway
ps8
May 16, 2014
Problem Set 8 Due Friday, May 23, 2014
If you liked working with a partner and want to do so again, you may, turning in one problem set per
group. I dont recommend groups of more tha
ECS 20: Discrete Mathematics for Computer Science
UC Davis  Professor Vladimir Filkov
June 1, 2012
Problem Set 6 Solutions
Problems:
(20) Problem 1. Suppose you have 40 different books (20 math books, 15 history books, and 5 geography books).
(a) You pic
ECS 122A: Introduction to Algorithms
UC Davis Vladimir Filkov
April 18, 2012
Problem Set 2 Solutions
(15) Problem 1. Give a direct proof of the following: If x is an odd integer and y is an even integer, then
x + y is odd.
Solution: Suppose x = 2k + 1, y
ECS122A Homework Assignment #7
Due: 4:00pm, March 17, 2014
Part I (Four problems)
1. (a) Run the BellmanFord algorithm on the following directed graph, using vertex y as the source.
Relax edges in lexicographic order in each pass, and show the d and valu
ECS122A Homework Assignment #4
Due: 4:00pm, February 14, 2014
1. For the sequences X = B, C, A, A, B, A and Y = A, B, A, C, B ,
(a) Follow the pseudocode LCSlength to ll in the dynamic programming c and b tables. for
nding the longest common subsequence
DEPT. OF COMPUTER SCIENCE, UNIVERSITY OF CALIFORNIA, DAVIS
ECSIZO, WINTER 2015 INSTRUCTOR: ROB GYSEL
N
Final Exam
K
March 12th, 2015
Name: 3 O L UT 1 o M 5 Student ID:
' Do not open the exam until instructed to do so.
' You will be given exactly 2 hours
DEPT. OF COMPUTER SCIENCE, UNIVERSITYVOF CALIFORNIA, DAVIS
ECSIZO, WINTER 2015 INSTRUCTOR: ROB GYSEL
Midterm #1
Name:
January 30th, 2015
Student ID:
Do not open the midterm until instructed to do so.
You 50 minutes to complete your test. When time is
DEPT. OF COMPUTER SCIENCE, UNIVERSITY OF CALIFORNIA, DAVIS
ECSIZO, WINTER 2015 INSTRUCTOR: ROB GYSEL
Midterm
February 16th, 2016
Name: 5 0L. g: :9 g; .3 Student ID:
0 Do not open the midterm until instructed to do so.
0 You will have 1hr and 20min to co
ECS 120 Notes
Rob Gysel
Scribe: Harjeet Manku
Februry 18, 2016
1. Turing Machine Formal Definitions :
Configuration.
Configuration Sequences.
Recognizable Languages.
Decide a Language.
Will transition to highlevel discussion of Variants, etc. Church
ECS120 Notes
January 19, 2016
Recall:
1)
2)
3)
4)
Regular Language closed under union (DFAs)
NFAs N, equivalent DFA M (L(N)=L(M)
DFAs M, equivalent NFA N
DFAs and NFAs recognize the regular languages
Recall: Product Construction
simulates both machines
D EPT.
OF C OMPUTER S CIENCE , U NIVERSITY OF C ALIFORNIA , D AVIS
ECS120, W INTER 2015
I NSTRUCTOR : R OB G YSEL
Midterm #1
January 30th , 2015
Name:
Student ID:
Do not open the midterm until instructed to do so.
You 50 minutes to complete your test. W
Tuesday, Febuary 2, 2016
ContextFree Grammars
ex:
G1 : A 0A1
AB
B
Or similarly, G1 : A 0A1B
B
Variables : usually uppercase (to be substituted)
Terminals : what we would like to end up with. not variables ( alphabet)
Start Variable : upper left coren
ECS 120 Notes
Rob Gysel
Scribe: David Ibrahim
January 14, 2016
Last Time: DFA & concatenation: hard to think about
Today: Nondeterminism, NFAs. (DFAs & NFAs are equivalent what does
that mean in this class?)
Properties:
DFAs (deterministic)
NFAs (nondeter
ECS 120 Notes
Rob Gysel
Scribe: Matt Gabor
January 21, 2015
Regular Expressions & Regular Languages
If time: Nonregular Languages
(0 1)1 represents cfw_0n 1m  n cfw_0, 1 and m 0
Shorthand for: (cfw_0 cfw_)1 cfw_1
Regular Expression R, language of R, L
D EPT.
OF C OMPUTER S CIENCE , U NIVERSITY OF C ALIFORNIA , D AVIS
ECS120, W INTER 2015
I NSTRUCTOR : R OB G YSEL
Final Exam
March 12th , 2015
Name:
Student ID:
Do not open the exam until instructed to do so.
You will be given exactly 2 hours to complet
Chapter 0: Introduction
slides 2017, David Doty
ECS 120: Theory of Computation
based on Introduction to the Theory of Computation by Sipser

Multivariate polynomials
16
15
14
13 2 2
4 3 =7
12
11
x2 y2 2
10
9
for
any
integers
8
7
32 22 = 5
6
5
4
3 22 12 =
c April 4, 2017, David Doty
Copyright
Homework 0 ECS 120, Spring 2017
Due date:
Sunday, April 9, 2017, 11:59pm
Instructions
Purpose. This homework is intended to ensure that you have mastered (some) background knowledge for this course covered in the pre
c April 30, 2017, David Doty
Copyright
Homework 2 ECS 120, Spring 2017
Due date:
Friday, May 5, 2017, 11:59pm
Inlecture quiz:
Tuesday, May 9, 2017, start of lecture
The autograded problems are worth 64% of this homework, and the written portion 36%.
1
A
# This DFA recognizes cfw_ x in cfw_0,1*  x does not end in 000
states:
qeande,
# starting state
qeand1,
qeand11,
qeand111,
qeand1111,
q0ande,
# reads 0
q0and1,
q0and11,
q0and111,
q0and1111,
q1ande,
# reads 1
q1and1,
q1and11,
q1and111,
q1and1111,
q01and