CS/ECE 374
Lab 9 Solutions October 19
Fall 2016
Recall the class scheduling problem described in lecture on Tuesday. We are given two arrays S[1 . n]
and F [1 . n], where S[i] < F [i] for each i , representing the start and finish times of n classes. Your
NEW CS 473: Theory II, Fall 2015
Midterm September 29, 2015, 56:50 PM
Location: Siebel 1404
1. The Game of Rat and Column.
1
(25 pts.)
[A similar but harder reduction had been shown in class.]
For the following decision problem, prove that it is NPC. A bi
1. Recurrences: 12 points
Give a tight asymptotic bound for the following recurrences. No justication necessary.
A(n) = 2A( n) + 1 for n > 9 and A(n) = 1 for 1 n 9.
(log n)
Recursion tree is a binary tree with depth log log n and work is 1 at each node s
NEW CS 473: Theory II, Fall 2015
Midterm September 29, 2015, 56:50 PM
Location: Siebel 1404
1. The Game of Rat and Column.
1
(25 pts.)
[A similar but harder reduction had been shown in class.]
For the following decision problem, prove that it is NPC. A bi
CS473 Spring 2014
Discussion 12
April 22/23, 2014
1. From Set Cover to Montone SAT
Consider an instance of a CNF formula specied by clauses C1 , C2 , . . . , Ck over a set
of boolean variables x1 , x2 , . . . , xn . We say is monotone if each term in each
CS/ECE 374
Lab 9 October 19
Fall 2016
Recall the class scheduling problem described in lecture on Tuesday. We are given two arrays
S[1 . n] and F [1 . n], where S[i] < F [i] for each i, representing the start and finish times of n
classes. Your goal is to
CS 473: Fundamental Algorithms, Spring 2013
Midterm 1: Conict Exam
Instructions:
(A) This is a closed book exam. No notes, books, calculators, cellphones, etc. are allowed.
(B) Graduate student: Answer all questions on the exam.
(C) Undergraduate student:
CS 473: Fundamental Algorithms, Spring 2013
a
Discussion 9
6/10
b
9/13
2/4
5/8
March 27, 2013
9.1.
4/4
Go With the Flow.
The gure on the right shows a ow network
along with a ow. In the gure, the notation
/ for an edge means that the ow on the
edge is and
CS 374 Fall 2014 Homework 4
Due Tuesday, October 7, 2014 at noon
1. For this problem, a subtree of a binary tree means any connected subgraph. A binary tree is complete
if every internal node has two children, and every leaf has exactly the same depth. De
CS 473: Algorithms, Fall 2010 HW 5 (due Tuesday, October 12)
This homework contains four problems. Read the instructions for submitting homework on the course webpage. In particular, make sure that you write the solutions for the problems on separate shee
CS 374
Homework 4 solutions
Fall 2014
1. For this problem, a subtree of a binary tree means any connected subgraph. A binary tree is complete if
every internal node has two children, and every leaf has exactly the same depth. Describe and analyze a
recurs
CS 473: Algorithms, Spring 2012
Midterm 1: February 23, 2012
Instructions:
This is a closed book exam. No notes, books, calculators, etc. are allowed.
Answer all problems. You can write I Dont Know for a problem (or its sub-parts) to
get 25% credit for
CS 473: Fundamental Algorithms, Spring 2013
Discussion 11
April 17, 2013
11.1.
Building 3CNF formulas.
(A) Consider the following boolean function f and g dened by a truth table. Generate a
3CNF formulas that computes these two functions.
x
z
f (x, y, z)
CS 473
1.
Homework 5 Solutions
Spring 2016
(a) Prove that the item returned by GetOneSample(S) is chosen uniformly at random from S .
Solution: Let P(i, n) denote the probability that GetOneSample(S) returns the ith
item in a given stream S of length n. W
CS 473: Fundamental Algorithms, Spring 2013
Conict Final Exam: 7pm-10pm, May 6, 2013
1. Multiple choice. (8 pts.)
For each of the questions below choose the most appropriate answer.
(A) Given a ow f on a network G with costs on the edges, there is a linea
CS 473: Algorithms, Fall 2010 HW 1 (due Tuesday, September 7th)
This homework contains four problems. Read the instructions for submitting homework on the course webpage. In particular, make sure that you write the solutions for the problems on separate s
CS 374 Fall 2014 Homework 8
Due Tuesday, November 4, 2014 at noon
1. After a grueling algorithms midterm, you decide to take the bus home. Since you planned ahead,
you have a schedule that lists the times and locations of every stop of every bus in Champa
CS 473
Homework 7 Solutions
Spring 2010
1. You are given a map of Sunnydale National Park, drawn as an undirected graph, where vertices represent landmarks in the park, and edges represent trails between those landmarks. (Trails start and end at landmarks
CS 473
Midterm 1 Questions
Spring 2016
Write your answers in the separate answer booklet.
Please return this question sheet and your cheat sheet with your answers.
1. For any positive integer n, the nth Fibonacci string Fn is defined recursively as follow
CS 473
Homework 10 Solutions
Spring 2010
1. Show that 2SAT is NP-hard, or describe a polynomial-time algorithm to solve it.
Solution: We describe a polynomial-time algorithm to solve 2SAT. Given a 2CNF boolean formula , the implication graph G is dened as
CS 473: Fundamental Algorithms, Spring 2011
HW 4
Homework is due by Monday, 23:59:59, February 21 Problem 1 is due by Sunday, 23:59:59, February 20 This homework contains four problems. Read the instructions for submitting homework on the course webpage.
HW 3 Solution: CS 473: Fundamental Algorithms, Spring 2013
Version: 1.0
1. (50 pts.) The vampire strikes back.
Several years back vampires took over Champaign, IL (this story did not get sucient coverage
in the lamestream media). It turns out that there a
CS 374 Fall 2014 Homework 7
Due Tuesday, October 28, 2014 at noon
1. You are standing next to a water pond, and you have three empty jars. Each jar holds a positive
integer number of gallons; the capacities of the three jars may or may not be different. Y
CS 473
Homework 6 Solutions
Fall 2013
1. Describe data structures that support Lookup in O(1) worst-case time and the other two operations in the
following time bounds.
(a) The worst-case time for both BLACKEN and NEXTWHITE is O(log n).
Solution (balanced
CS 473
Homework 2 Solutions
Spring 2014
1. Kris is a professional rock climber who is competing in the U.S. climbing nationals. The competition requires
him to complete the following task: He is given a set of n holds that he might use to create a route w
CS 374
1.
Homework 2 Solutions
Fall 2014
(a) Describe a DFA that accepts the set of all C comments.
Solution: The following eight-state DFA recognizes the language of C comments. All missing
transitions lead to a hidden reject state.
/
L
/
/
s
/*A
/
/A
*
CS 473
Homework 3 (due September 24, 2013)
Fall 2013
1. A standard method to improve the cache performance of search trees is to pack more search keys
and subtrees into each node. A B-tree is a rooted tree in which each internal node stores up to B
keys a
CS 473
Homework 4 (due March 2, 2010)
Spring 2010
1. Suppose we want to write an efcient function SHUFFLE(n) that returns a permutation of the set cfw_1, 2, . . . , n chosen uniformly at random. (a) Prove that the following algorithm is not correct. [Hint