Question

In: Computer Science

Answer True or False 1. For graph representation, adjacency Matrix is more efficiency than adjacency list...

Answer True or False

1. For graph representation, adjacency Matrix is more efficiency than adjacency list in term of searching for edge.

2. Topological sort runs in O(|V| + |E|) where |V| is the number of vertices, and |E| is the number of edges in the input graph.

3. If vertex u can reach vertex v, and vertex v can reach vertex u, then vertices u and v are in the same Strongly-connected component (SCC).

4. The Bellman-Ford algorithm will run forever if the input graph has negative weights on the edges.

5. For a graph with only positive edge weights, Dijkstra's algorithm solves the single-source shortest path (SSSP) problem faster than Bellman-Ford on a graph.

6. Dynamic programming depends on the input problem having an optimal substructure.

7. The longest-common subsequence problem on strings of length n and m can be solved in time O(nm).

8. The adjacency matrix’s space complexity is O(|V|+|E|), for a graph G = .

9. Given any two strings S1 and S2, there is only one longest common subsequence (that is, the LCS is unique).

10. Depth-First Search runs in O(|V| + |E|) where |V| is the number of vertices, and |E| is the number of edges in the input graph.

Breadth-First Search finds the shortest distance --- in terms of the number of hops --- from source vertex to each other reachable vertex in a graph.

Kruskal's algorithm is a greedy algorithm.

For any graph G with positive edge weights, there is only 1 minimum-spanning-tree (MST) for G.

The time complexity of rod-cutting problem is Θ(n2)

2^(n+1)= O(2^n)

Solutions

Expert Solution

1.For graph representation, adjacency Matrix is more efficiency than adjacency list in term of searching for edge.

Ans:True

2.Topological sort runs in O(|V| + |E|) where |V| is the number of vertices, and |E| is the number of edges in the input graph.

Ans:True

3.If vertex u can reach vertex v, and vertex v can reach vertex u, then vertices u and v are in the same Strongly-connected component (SCC).

Ans:True

4.The Bellman-Ford algorithm will run forever if the input graph has negative weights on the edges.

Ans:True

5.For a graph with only positive edge weights, Dijkstra's algorithm solves the single-source shortest path (SSSP) problem faster than Bellman-Ford on a graph.

Ans:False

6. Dynamic programming depends on the input problem having an optimal substructure.

Ans:True

7.The longest-common subsequence problem on strings of length n and m can be solved in time O(nm).

Ans:False

Explanation:Time complexity of the above longest-common subsequence problem is O(2^n)

8.The adjacency matrix’s space complexity is O(|V|+|E|), for a graph G

Ans:True

9.Given any two strings S1 and S2, there is only one longest common subsequence (that is, the LCS is unique).

Ans:False

Explanation:Not always the longest common subsequence is unique, sometimes there can be multiple longest common subsequences of equal length.

10.Depth-First Search runs in O(|V| + |E|) where |V| is the number of vertices, and |E| is the number of edges in the input graph.

Ans:True

11.Breadth-First Search finds the shortest distance --- in terms of the number of hops --- from source vertex to each other reachable vertex in a graph.

Ans:True

12.Kruskal's algorithm is a greedy algorithm.

Ans:True

Explanation:It is a greedy algorithm in graph theory as in each step it adds the next lowest-weight edge that will not form a cycle to the minimum spanning forest.

13.For any graph G with positive edge weights, there is only 1 minimum-spanning-tree (MST) for G.

Ans:False

Explanation: If each edge has a distinct weight then there will be only one, unique minimum spanning tree.

14The time complexity of rod-cutting problem is Θ(n2) 2^(n+1)= O(2^n)

Explanation:Time Complexity depends on the type of programing implementation used in rod-cutting problem.


Related Solutions

One simple representation for a graph is to use an adjacency matrix: each of the N...
One simple representation for a graph is to use an adjacency matrix: each of the N nodes is given a unique number in the range 0 to N-1 to identify it. A large two dimensional array A with N rows and N columns is created so that A[x][y] stores the cost of travelling directly from node x to node y. if A[x][y] is zero, then there is no direct connection from x to y. A[x][y] does not need to equal...
True or False, explain your answer: a) An observation with a studentized residual of more than...
True or False, explain your answer: a) An observation with a studentized residual of more than 10 is probably an outlier. b) If assumptions are met, least squares residuals are not correlated with the fitted values. c) It is possible to reject a null hypothesis when the null hypothesis is true.
1. Implement the graph ADT using the adjacency list structure. 2. Implement the graph ADT using...
1. Implement the graph ADT using the adjacency list structure. 2. Implement the graph ADT using the adjacency matrix structure. LANGUAGE IS IN JAVA Comment for any questions Data structures and algorithms
I need detailed long answer, more than 1 page, with references. True/ False - On average,...
I need detailed long answer, more than 1 page, with references. True/ False - On average, acquisitions destroy shareholder value Identify a corporate acquistion (within the last 10 years) which added value to the acquiring company and discuss a minimum of three (3) key factors which enabled their success?
Python3 question. Suppose that a graph represent as adjacency matrix, how could it perform DFS by...
Python3 question. Suppose that a graph represent as adjacency matrix, how could it perform DFS by using stack. Graph is a undirect and unweighted graph.
Java Implementation It uses adjacency list representation, and already has the loadAdjList() function implemented for reading...
Java Implementation It uses adjacency list representation, and already has the loadAdjList() function implemented for reading adjacency lists from standard input (make sure you understand the input format and how loadAdjList() works). You need to complete the function printAdjMatrix(). import java.util.LinkedList; import java.util.Scanner; import java.util.Iterator; class Graph { private int totalVertex; private LinkedList<LinkedList<Integer>> adjList; //adjacency list of edges public Graph() { totalVertex = 0; } public void loadAdjList() { Scanner in = new Scanner(System.in); totalVertex = in.nextInt(); adjList = new...
True or false: 1) If a nation is selling more goods and services to foreigners than...
True or false: 1) If a nation is selling more goods and services to foreigners than it is buying from them, then on net it must be selling assets abroad. 2) It is possible for a country to have domestic investment that exceeds national saving. 3) If a country’s trade surplus falls, its net capital outflow rises. 4) If the exchange rate is 80 yen per dollar, then a hotel room in Tokyo that costs 25,000 yen costs $200. 5)...
Question 4. Answer in True or False. a)An ogive is a frequency polygon graph of the...
Question 4. Answer in True or False. a)An ogive is a frequency polygon graph of the cumulative frequency or the relative cumulative frequency with the horizontal axis marked at the midpoints and the vertical axis is the frequency or relative frequency. b)The coefficient of determination measures the strength of the relationship between the two variables in simple linear regression. c)Two mutually exclusive events will have a joint probability of one.
1) True or False: a) CH3Br is a more reactive electrophile than CH3Cl because Br is...
1) True or False: a) CH3Br is a more reactive electrophile than CH3Cl because Br is more electronegative than Cl b) Iodide anion is a more reactive nucleophile than bromide anion. c) Dehydrohalogenation of alkyl halides forms the trans-isomer as the major alkene product. d)The (E)- and (Z)- alkene isomers are a pair of diastereomers. e) The reaction between a secondary alkyl bromide and a sodium alkoxide salt (NaOR) gives a major product from nucleophilic substitution.
True or False? Explain. 1.     T / F         An export subsidy is more common than...
True or False? Explain. 1.     T / F         An export subsidy is more common than an export duty. 2.     T / F         Although it discourages most tariffs, the WTO allows an importing country to levy antidumping tariffs. 3.     T / F         Strategic trade policy and predatory dumping are weapons of economic warfare. 4.     T / F         Japan is the world’s leading steel exporter. 5.     T / F         If a country levies a countervailing duty against...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT