Showing 1 to 30 of 122

CS6505: Computability & Algorithms
Homework 6 Solutions.
Prove that the following decision problems are NP-complete.
1. Given two graphs G1 , G2 and an integer k , determine whether there exists a graph H with
at least k edges such that H is contained in

CS6505 Computability, Algorithms, and Complexity
Homework 1: Due Friday, August 31, 2012
(Total 60 points)
1. (15 points) A verier is a deterministic Turing machine V that is a decider that takes two arguments
x (the input) and y (the proof).
Show that a

Time Complexity for DTMs
M is a 1-tape DTM that halts on all inputs.
The time taken by M on an input w is the number of steps M uses to accept or reject.
The running time of M is a function of the input length:
the maximum of the time taken by M on any i

CS6505: Computability & Algorithms
Homework 10.
Due in class on Fri, Apr 6.
1. Consider the following greedy algorithm for nding a maximum matching: Start with an
arbitrary edge as the initial matching. Find another edge that does not have a vertex in
com

# Given two sets A and B of integers, their sum set C is defined to be
# C = cfw_a+b: aA, bB. For each c \in C, let m(c)denote the number of ways in
# which c can be obtained, i.e., m(c) = |cfw_(a,b) : a A, b B, a+c = c|.
# For example, if A = cfw_1,2,3

#This exercise asks you to solve a problem using
#a maximum flow algorithm as a subroutine. For
#this purpose, you may use the provided maximumflow
#module, which contains the following three functions
#
#(flow,cut) = maxflow_mincut(C,s,t):
# C is assum

CS6505 Computability, Algorithms, and Complexity
Homework 1: Due Friday, August 31, 2012
(Total 60 points)
1. (15 points) A verier is a deterministic Turing machine V that is a decider that takes two arguments
x (the input) and y (the proof).
Show that a

CS6505 Computability, Algorithms, and Complexity
Fall 2012
TEST 1
Total 60 points
NAME:
NOTES:
Read all the questions. Questions on pages 2, 3, 4, and 5.
You can bring a sheet with notes on both sides. You may not use any other source.
You can use with

#This exercise asks you to solve a problem using
#a maximum flow algorithm as a subroutine. For
#this purpose, you may use the provided maximumflow
#module, which contains the following three functions
#
#(flow,cut) = maxflow_mincut(C,s,t):
# C is assum

CS6505: Computability & Algorithms
Homework 8 Solutions
1. Given a graph G, a vertex cover is a set S of vertices so that every edge in G has at least one
endpoint in S . Consider the following randomized algorithm for nding a small vertex cover:
Start wi

CS6505: Computability & Algorithms
Homework 7 Solution.
1. You are given two n n matrices, with n = 2k for some natural number k , such that each
matrix has the following recursive structure: when divided into four equal-size blocks, the
two diagonal bloc

CS6505: Computability & Algorithms
Homework 5 Solutions.
1. Let G = (V, E ) be a graph with nonnegative edge weights w(u, v ) for each edge (u, v ) E ,
and s, t be a pair of nodes in G. The weight of a path from s to t is dened as the maximum
of the weigh

CS6505: Computability & Algorithms
Homework 4 Solutions.
1. Given a graph G, a matching in G is a set of edges such that no two of them share a vertex.
Let MATCHING = cfw_(G, k ) : G has a matching of size k , i.e., the language consisting of
graphs G wit

1.
An instance of the subgraph isomorphism problem consists of two graphs
G1=(V 1 , E1 ) and G2=(V 2 , E2 ) . In a positive instance, G2 is isomorphic to a
G1 . That is to say, there is a subset V ' V 1 and a bijection
f : V 2 V ' such that (u , v ) E2 if

1.
Describe how you might use nondeterminism to simplify the construction of a Turing
machine that performs the following tasks.
a. Decide the language cfw_www is a binary string
b. Recognizes the language cfw_<M> | M accepts some string
2.
Construct a S

1.
An instance of the half 3-CNF satisfiability problem is a collection of m clauses each
having 3 literals. A positive instance is one where there exists an assignment that
makes exactly of the clauses evaluate to True.
Prove that half 3-CNF SAT is NP-Co

1.
Suppose that you are the instructor for an algorithms course. As part of an assignment,
you have asked your students to write code that returns a longest palindromic
subsequence of a string. When you realize this means that you have grade more than
200

mi is included, we have that P (i) = pi +P (last(i). Therefore, the recurrence
is the following:
P (i) = maxcfw_P (i 1), pi + P (last(i)
It is easy to modify the earlier pseudocode to obtain an O(n2 ) time solution. In fact, by first calculating last(i) f

Solutions for [DPV] Practice Dynamic Programming Problems
[DPV] Problem 6.8 Longest common substring
Solution:
Here we are doing the longest common substring (LCStr), as opposed
to the longest common subsequence (LCS). First, we need to figure out the
sub

Algorithm 2 Coin Changing I
S(0) = TRUE.
for j = 1 to v do
S(j) = FALSE.
end for
for i = 1 to v do
for j = 1 to n do
if i xj 0 then
S(i) S(i xj ) S(i)
end if
end for
end for
return S(v)
[DPV] Problem 6.18 Making change II
Solution: This problem is very si