Find the Algorithm Solutions Mathematical Questions

User Generated

njwhqlqj

Mathematics

Description

Q1. Short proofs/counterexamples, Determine whether each of the following statements is true or false. If it is true, briefly prove that it is true. If it is false, provide a counterexample showing why it is false. (You may reference results proven in class; however, you are expected to explain any relevant parts the question asks.)

# 1. An algorithm for the interval scheduling problem that accepts requests in order of latest starting time (eliminating all conflicting requests with each accepted request) always gives an optimal solution.

#2. Let G = (V, E) be a connected, undirected graph and let l_1: E→(0,∞) be a function that gives the length of each edge. If we define a new edge length function l_2:E→(0,∞) such that l_2(e)=[l_1(e)] ^2 , then the shortest path between any two nodes v,w ∈V is the same regardless of whether we measure edge lengths using l_1 or l_2

#3. Let G=(V,E) be a connected graph and c: E→[0,∞) be a cost function. Assume there is a unique most costly edge. Then the most costly edge is never in the minimal spanning tree of G.

Q2. Algorithmic solutions, For each of the following subproblems, briefly explain how you would solve each. You do not need to write pseudocode. Give a big-O estimate on the runtime of your solution with a very brief justification. You do not need to solve the problems as efficiently as possible.


#1. Given a graph G = (V,E) with n nodes and m edges, determine the number of connected components in G.

#2. Given a graph G=(V,E) in which V is Facebook users, and (v,w) ∈E if users v and w are Facebook friends, how many friend-of-friend connections does Facebook user Devina Hamburger have? (That is, how many users have a shortest path of two edges to Devina?)

#3.The pictured graph represents a directed graph G=(V,E) with edge capacities c:E→[0,∞) given in unboxed numbers along the edges, and a valid flow f:E→[0,∞) given in boxed numbers along the edges.

38446816-7E17-4ED8-B76F-603B7F612A57.png

#3A. Draw the residual graph G_f corresponding to the capacities and flows shown above, labeling all edges in G_f with their residual capacities. Use arrows to indicate the direction of each edge.

#3B. Is the given flow a max flow? Justify your answer.

#4. Suppose T(n) is a nondecreasing function such that T(1) = 7 and T(n)≤9T(n/3)+n for all n > 1. Show that T(n)=O(n^2). (You must use an argument similar to one used in class. Do not use theorems from outside this class.)


Q3. Brief explanations,Give brief explanations for each subproblem.

#1. Very briefly explain why the solution we discussed in class for the knapsack problem cannot be considered truly polynomial in runtime.

#2 .The following statement is true. Briefly explain why it is true.

Consider an instance of the knapsack problem with n objects {0,…,n−1} where object i has weight w_i , value v_i , and the knapsack holds a maximum weight of W. If all the v_i 's are the same, then the optimal solution can be found in O(nlogn) operations.

#3. The following statement is false. Give a counterexample showing why.

Suppose G=(V,E) is a directed graph with capacities c: E→(0,∞). Let s and t be the source and sink nodes. Suppose G has a path from s to t. If we increase c(e) by 1 for every edge coming from s (that is, every edge of the form e=(s,v) for some v∈V), then the value of the max flow with the new capacities must be larger than the original value.

Unformatted Attachment Preview

ALGORITHM HW Q1. Short proofs/counterexamples, Determine whether each of the following statements is true or false. If it is true, briefly prove that it is true. If it is false, provide a counterexample showing why it is false. (You may reference results proven in class; however, you are expected to explain any relevant parts the question asks.) # 1. An algorithm for the interval scheduling problem that accepts requests in order of latest starting time (eliminating all conflicting requests with each accepted request) always gives an optimal solution. #2. Let G = (V, E) be a connected, undirected graph and let |_1: E+(0,00) be a function that gives the length of each edge. If we define a new edge length function (_2:E=(0,00) such that l_2(e)=[l_1(e)]^2, then the shortest path between any two nodes vw eV is the same regardless of whether we measure edge lengths using L_1 or l_2 #3. Let G=(V,E) be a connected graph and c: E-[0,00) be a cost function. Assume there is a unique most costly edge. Then the most costly edge is never in the minimal spanning tree of G. Q2. Algorithmic solutions, For each of the following subproblems, briefly explain how you would solve each. You do not need to write pseudocode. Give a big-O estimate on the runtime of your solution with a very brief justification. You do not need to solve the problems as efficiently as possible. #1. Given a graph G = (V,E) with n nodes and m edges, determine the number of connected components in G. #2. Given a graph G=(V,E) in which V is Facebook users, and (vw) CE if users v and w are Facebook friends, how many friend-of-friend connections does Facebook user Devina Hamburger have? (That is, how many users have a shortest path of two edges to Devina?) #3.The pictured graph represents a directed graph G=(V,E) with edge capacities c:E→[0,00) given in unboxed numbers along the edges, and a valid flow f:E=[0,00) given in boxed numbers along the edges. 5 9 f 00 21 7 a 3 3 2 10 b 2 4 0 9 7 с S 4 33 #3A. Draw the residual graph G_f corresponding to the capacities and flows shown above, labeling all edges in G_f with their residual capacities. Use arrows to indicate the direction of each edge. #3B. Is the given flow a max flow? Justify your answer. #4. Suppose T(n) is a nondecreasing function such that T(1) = 7 and T(n)s9T(n/3)+n for all n > 1. Show that T(n)=O(n^2). (You must use an argument similar to one used in class. Do not use theorems from outside this class.) Q2. Brief explanations, Give brief explanations for each subproblem. #1. Very briefly explain why the solution we discussed in class for the knapsack problem cannot be considered truly polynomial in runtime. #2. The following statement is true. Briefly explain why it is true. Consider an instance of the knapsack problem with n objects {O,...,n-1} where object i has weight w_i, value vi, and the knapsack holds a maximum weight of W. If all the v_i's are the same, then the optimal solution can be found in O(nlogn) operations. #3. The following statement is false. Give a counterexample showing why. Suppose G=(V,E) is a directed graph with capacities c: E=(0,00). Lets and t be the source and sink nodes. Suppose G has a path from s to t. If we increase cle) by 1 for every edge coming from s (that is, every edge of the form e=(s.) for some veV), then the value of the max flow with the new capacities must be larger than the original value. KNAPTACK Prop. (coris) RUNTIME: THINKING ABOUT Hou THE PROBLEM SCALES w/ Me Size of 746 laspur OBJECTS: Oln) MEMORY 10 STORE OBJECT WFO WIS Oy Ollog W) memory NED to Srons W. * so THE RUNTIME IS REALLY EX POJESTIAL لے Toons of Tue INPUT SIZE ( compute opt is OLW) ) T "PSEUDOPPLYNOMIAL"
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

View attached explanation and answer. Let me know if you...

Related Tags