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
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 1 Solutions.
1. Countability.
(a) Since S1 and S2 are countable, there exists a bijection f1 : S1 N and f2 : S2 N .
To prove that S1 S2 is countable, we need to dene a bijection g : N N N .
The bijection N N N i
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/Homework 2
Due on: Friday, September 21, 2012
1. (15 points) Let Sk = cfw_ M , k | M is a 1 tape DTM and L(M ) has k strings.
Show that ATM m Sk .
Solution: Here is one reduction.
On input M , w ,
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
#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/Homework 2
Due on: Friday, September 21, 2012
1. (15 points) Let Sk = cfw_ M , k | M is a 1 tape DTM and L(M ) has k strings.
Show that ATM m Sk .
2. (15 points) Let L = cfw_ M | L(M ) is innite .
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
CS6505 Computability, Algorithms, and Complexity
Homework 1 solutions sketch. 1. (15 points) Consider the simulation of a multitape Turing machine M by a single-tape Turing machine S as described in the proof of Theorem 3.13 in the text. Let k = 2. (a) Gi
#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
import numpy as np
#Suppose there is a procedure inA that decides a language A.
#Use dynamic programming (not memoization) to create an
#algorithm that decides A* while calling inA only O(n^2) times,
#where n is the length of the input string.
#This is
Last Name: . First Name: . Email: .
CS 6505, Fall 2016, Homework 1, 8/26/16 Due 9/2/16 in class
Page 1/10
Problem 1: Analysis of Recursive Algorithm (10 points).
Consider the function Mystery defined below.
Mystery(n)
if n > 1 then begin
print(x);
Mystery
Last Name: . First Name: . Email: .
CS 6505, Fall 2016, Homework 2, 9/2/16 Due 9/9/16 in class
Page 1a/5
Problem 1: Recurrences I (20 points).
Solve the following recurrence relations by substritution.
Give the exact answer
as a function of n (ie no asymp
Last Name: . First Name: . Email: .
CS 6505, Fall 2016, Homework 8, 11/12/16 Due 11/19/16 in class Page 1/9
Problem 1: Hamilton Cycle (10 points)
Directed HC is the following problem:
Input: A directed graph G(V, E).
Output: YES if G has a simple cycle of
Last Name: . First Name: . Email: .
CS 6505, Fall 2016, Homework 9-Quiz 3, 11/21/16 Due 11/30/16 in class Page 1/8
Problem 1: Stingy 3SAT (10 points)
Stingy 3SAT is the following problem: given a set of clauses (each a disjunction of literals) and an inte
Last Name: . First Name: . Email: .
CS 6505, Fall 2016, Homework 5+6, 10/1/16 Due 10/7/16 in class
Page 1/5
Problem 1: All Pairs Shortest Paths, Dynamic Programming ( 20 points) .
Let G(V, E) be a directed graph with costs on its edges. The costs can be e
Last Name: . First Name: . Email: .
CS 6505, Fall 2016, Homework 7 and Quiz 2, 10/19/16 Due 10/26/16 in class Page 1/10
Problem 1: MST Kruskal (10 points)
Give the order in which Kruskals algorithm examines the edges of the graph below. For every edge e t
#Suppose we have a one-tape Turing machine M whose
#head instead of having to move just left or right
#in each computation step, can move left or right
#or stay put. We called these stay-put machines
#in the lesson.
#It is possible to create a new st
1.
Suppose someone asked you to cover an irregular shaped checkerboard with 2x1
pieces or to tell if its impossible. See the image below for an example. Explain how you
might use a maximum bipartite matching algorithm.
2.
Recall that a matching is a set o
1.
Suppose that a flow network (V , E ,c , s ,t ) admits a flow f , where v ( f )> 0 .
a. Show that the network must have positive flow path. That is to say, there is an st path p where f (u , v)>0 , for every (u , v ) p .
b. Consider a flow f ' , where f
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
#$%
#$(
#$(
#$(
#$(
2" =(2" )"
= 4" 4" 3 = 1" 3 = 1 3
2
4 mod 79 is the reverse of 20 mod 79
21 mod 62 is the reverse of 3 mod 62
There is no reverse for 21 mod 91 because gcd(21,91)>1
14 mod 23 is the reverse of 5 mod 23
3
If a has an in