CS 170
Algorithms
Spring 2014
Elchanan Mossel
HW 1
Due January 31st, 6:00pm
Instructions: You are welcome to form small groups (up to four people) to work through the homework,
but you must write up a
U.C. Berkeley CS170 : Algorithms, Fall 2014
Professor: Elchanan Mossel
Midterm 1
Feb 20, 2014
Midterm 1
Name:
SID:
TA:
Section Time:
Person on Right:
Person on Left:
Answer all questions. Read them ca
U.C. Berkeley CS170 : Algorithms, Fall 2014
Professor: Elchanan Mossel
Midterm 1
Feb 20, 2014
Midterm 1 Solutions
Name:
SID:
TA:
Section Time:
Person on Right:
Person on Left:
Answer all questions. Re
CS 170
Algorithms
Spring 2014
Elchanan Mossel
1. (16 pts.)
HW 5
Shortest Path Currency Trading
a) Represent the currencies as the vertex set V of a complete directed graph G. To nd
the most advantageo
5.3 Horn formulas
In order to display human-level intelligence, a computer must be able to perform at least some
modicum of logical reasoning. Horn formulas are a particular framework for doing this,
CS170 Discussion Section 14: 4/27-4/29
Falafels Limited
You are the CTO of FL (Falafel Limited). Your company is planning to deploy falafel carts
on Mission Street in San Francisco. You may deploy car
CS 170, Spring 2016
Discussion Section
A. Chiesa & U. Vazirani
CS170 Discussion Section 7: 3/2 - 3/4
1. Playing with Rocks
You and your friend are playing a game called the Rocks Game. The game starts
CS 170, Spring 2016
Discussion Section
A. Chiesa & U. Vazirani
CS170 Discussion Section 8: 3/9 - 3/11
1
Pig
Pig is a 2-player game played with a 6-sided die. On your turn, you can decide either to rol
CS 170, Spring 2016
Discussion Section
A. Chiesa & U. Vazirani
CS170 Discussion Section 5: 2/17 - 2/19
1. Minimum Spanning Trees
For each of the following statements, either prove or supply a countere
CS 170, Spring 2016
Discussion Section
A. Chiesa & U. Vazirani
CS170 Discussion Section 12: 4/13 - 4/16
Reliable Network
Reliable Network is the following problem: We are given two n n matrices, a cos
CS 170, Spring 2016
Discussion Section
A. Chiesa & U. Vazirani
CS170 Discussion Section 11: 4/6 - 4/9
Glossary
Shown below are some of the problems that we will refer to in this worksheet. They are al
CS170 Discussion Section 13: 4/20-4/22
Half Rudrata Path
Recall that the Rudrata Path problem (Given a graph (V, E), find a path (no repeated
nodes) of length (number of edges) |V | 1) is NP-complete.
Algorithms
c
Copyright 2006
S. Dasgupta, C. H. Papadimitriou, and U. V. Vazirani
July 18, 2006
2
Contents
Preface
0 Prologue
0.1 Books and algorithms
0.2 Enter Fibonacci . . .
0.3 Big-O notation . . .
Exercises
3.1. Perform a depth-first search on the following graph; whenever theres a choice of vertices, pick
the one that is alphabetically first. Classify each edge as a tree edge or back edge, and
Figure 8.9 S is a vertex cover if and only if V S is an independent set.
S
It is easy to see that in the new formula no variable appears more than three times
(and in fact, no literal appears more tha
Chapter 2
Divide-and-conquer algorithms
The divide-and-conquer strategy solves a problem by:
1. Breaking it into subproblems that are themselves smaller instances of the same type of
problem
2. Recurs
Figure 7.5 An illustration of the max-flow algorithm. (a) A toy network. (b) The first path
chosen. (c) The second path chosen. (d) The final flow. (e) We could have chosen this path first.
(f) In whi
CS170 Discussion Section 10: 11/2-11/4
Repairing a Flow
In a particular network G = (V, E) whose edges have integer capacities ce , we have already
found the maximum flow f from node s to node t. Howe
CS 170, Spring 2016
Discussion Section
A. Chiesa & U. Vazirani
CS170 Discussion Section 6: 2/24 - 2/26
MST Practice
Find the minimum spanning tree of the following weighted graph. You may want to try
CS 170
Algorithms
Spring 2014
E. Mossel
1. (20 pts.)
HW 3
Problem 2.24 (Quicksort)
1. (5 points). In the worst case we always pick A[k] that is the largest element of A. Then, we
only decrease the pro
CS 170
Algorithms
Spring 2014
Elchanan Mossel
1. (8 pts.)
HW 1
Getting Started
Students receive full credit for writing I understand the course policies under problem 1.
2. (17 pts.)
Compare Growth Ra
CS 170
Algorithms
Spring 2014
Elchanan Mossel
HW 2
Due February 7th, 6:00pm
This homework is due Friday, February 7, at 6:00pm electronically. You need to submit it via Pandagrader.
Please see Piazza
CS 170
Algorithms
Spring 2014
E. Mossel
HW 3
Due February 14th, 6:00pm
This homework is due Friday, February 14, at 6:00pm electronically. You need to submit it via Pandagrader.
Please ask on piazza f
U.C. Berkeley CS170 : Algorithms, Fall 2014
Professor: Elchanan Mossel
Midterm #2
Mar 20, 2014
Midterm #2 Solutions
Answer all questions.
Read them carefully rst.
Be precise and concise.
Justify c
U.C. Berkeley CS170 : Algorithms, Fall 2014
Professor: Elchanan Mossel
Midterm Mar 20, 2014
Mar 20, 2014
Midterm Mar 20, 2014
Name (if you are using more than one name please write all names):
SID:
Pe
U.C. Berkeley CS170: Algorithms
Midterm 2
Lecturers: Umesh Vazirani & Christos Papadimitriou
April 1, 2004
Midterm 2
Name:
TA:
Answer all questions. Read them carefully first. Be precise and concise.
CS 170
Algorithms
Spring 2014
E. Mossel
HW 4
Due February 28th, 6:00pm
This homework is due Friday, February 28th, at 6:00pm electronically. You need to submit it via Pandagrader
with your instruction