Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 25, Problem 2P
(a)
Program Plan Intro
To show the running time complexity of INSERT, EXTRACT-MIN, DECREASE-KEY in d -array min-heap of ‘ n’ elements and if the value of
(b)
Program Plan Intro
To find the shortest path problem solution if the graph does not contains negative weight in O ( E ) time.
(c)
Program Plan Intro
To find the shortest path problem solution if the graph does not contains negative weight.
(d)
Program Plan Intro
To find the shortest path problem solution if the graph contains negative weights but not negative weight cycle.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Each of the following two algorithms takes a connected graph and a weight function as input andreturns a set of edges T. For each algorithm, either prove (use logical arguments) or disprove (give a counter example) that T is a minimum spanning tree. Describe (no pseudo code) the mostefficient implementation of each algorithm, whether or not it computes a minimum spanning tree.
(1)
Maybe-MST-A(G, w) T = ∅ for each edge e, taken in arbitrary order T = T ∪ {e} if T has a cycle c let e' be the maximum weight edge in c T = T − {e'} return T
(2)
Maybe-MST-B(G, w) sort the edges into non-increasing order of edge weight w T = E for each edge e, taken in non-increasing order by weight if T – {e} is a connected graph T = T – {e} return T
Given an undirected weighted graph G with n nodes and m edges, and we have used Prim’s algorithm to construct a minimum spanning tree T. Suppose the weight of one of the tree edge ((u, v) ∈ T) is changed from w to w′, design an algorithm to verify whether T is still a minimum spanning tree. Your algorithm should run in O(m) time, and explain why your algorithm is correct. You can assume all the weights are distinct. (Hint: When an edge is removed, nodes of T will break into two groups. Which edge should we choose in the cut of these two groups?)
Most graph algorithms that take an n×n adjacency-matrix representation as input require at least time O(n^2), but there are some exceptions. Show how to determine whether a simple directed graph G contains a universal sink, that is, a vertex with in degree n − 1 and out-degree 0, in time O(n) given an n × n adjacency matrix for G. (A vertex v has indegree k if there are precisely k edges of the form (u, v), and has outdegree k if there are precisely k edges of the form (v, u).)
Chapter 25 Solutions
Introduction to Algorithms
Ch. 25.1 - Prob. 1ECh. 25.1 - Prob. 2ECh. 25.1 - Prob. 3ECh. 25.1 - Prob. 4ECh. 25.1 - Prob. 5ECh. 25.1 - Prob. 6ECh. 25.1 - Prob. 7ECh. 25.1 - Prob. 8ECh. 25.1 - Prob. 9ECh. 25.1 - Prob. 10E
Ch. 25.2 - Prob. 1ECh. 25.2 - Prob. 2ECh. 25.2 - Prob. 3ECh. 25.2 - Prob. 4ECh. 25.2 - Prob. 5ECh. 25.2 - Prob. 6ECh. 25.2 - Prob. 7ECh. 25.2 - Prob. 8ECh. 25.2 - Prob. 9ECh. 25.3 - Prob. 1ECh. 25.3 - Prob. 2ECh. 25.3 - Prob. 3ECh. 25.3 - Prob. 4ECh. 25.3 - Prob. 5ECh. 25.3 - Prob. 6ECh. 25 - Prob. 1PCh. 25 - Prob. 2P
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Consider the so-called k-Minimum Spanning Tree (k-MST) problem, which is defined as follows. An instance of the k-MST problem is given by a connected undirected graph G=(V,E) with edge weights w:E→Q and a natural number k>2. The question is to find a tree with exactly k nodes that is a subgraph of G and minimises the weight among all such trees. Informally, k-MST is the variant of the minimum spanning tree problem, where instead of a spanning tree one wants to find a tree with exactly k nodes. What would be the result if we apply Prim's, respectively Kruskal's, algorithm to the problem by stopping both algorithms after k−1 edges have been added? In the following we refer to these versions of Prim's and Kruskal's algorithm as the modified algorithm of Prime or Kruskal, respectively. a) consider the following graph. (image provided- image 1) For which of the following edge weights, assigned to the graph above, does the modified algorithm of Kruskal provide a wrong result assuming…arrow_forwardWe have undirected graph K, with two distinct vertices z, k. And let O be a minimum spanning tree of K. Prove that the path from z to k along O is a minmax path. Assume that K has distinct edge weights. (Assume for contradiction that the minmax path is not completely on the minimum spanning tree.) Note: A MinMax path in an undirected Graph K is a path between two vertices z, k that minimizes the maximum weight of the edges on the pat h.h.arrow_forwardThe following solution designed from a problem-solving strategy has been proposed for finding a minimum spanning tree (MST) in a connected weighted graph G: Randomly divide the vertices in the graph into two subsets to form two connected weighted subgraphs with equal number of vertices or differing by at most Each subgraph contains all the edges whose vertices both belong to the subgraph’s vertex set. Find a MST for each subgraph using Kruskal’s Connect the two MSTs by choosing an edge with minimum wight amongst those edges connecting Is the final minimum spanning tree found a MST for G? Justify your answer.arrow_forward
- Let G = (V,E) be a bipartite graph, but this time it is a weighted graph. The weight of acomplete matching is the sum of the weights of its edges. We are interested in finding aminimum-weight complete matching in G.a) Give a legitimate C for a branch-and-bound (B&B) algorithm that finds a minimum-weightcomplete matching in G, and prove that your C is valid. Your C cannot be just the cost sofar.b) Using your C, apply B&B to find a minimum-weight complete matching in the followingweighted bipartite graph G: A = (1,2,3), B = (4,5,6,7)E = (((1,4), 3]. [(1,5), 4]. [(1,7). 15]. ((2,4), 1]. |(2,5), 8]. [(2,6), 3]. |(3,4), 3]. [(3,5), 9]. [ (3,6). 51).Show the solution tree. the C of every tree node generated, and the optimal solution. Also,mark the order in which each node in the solution tree is visited.arrow_forwardThe transpose of a directed graph G = (V, E) is the graph GT = (V; ET), where ET = { (u, v) | (v, u) ϵ E}. Thus, GT is G with all its edges reversed. Describe efficient algorithms for computing GT from G, for both the adjacency-list and adjacency-matrix representations of G. Analyze the running times of your algorithms.arrow_forwardConsider an undirected graph on 8 vertices, with 12 edges given as shown below: Q2.1 Give the result of running Kruskal's algorithm on this edge sequence (specify the order in which the edges are selected). Q2.2 For the same graph, exhibit a cut that certifies that the edge ry is in the minimum spanning tree. Your answer should be in the form E(S, V/S) for some vertex set S. Specifically, you should find S.arrow_forward
- There is an undirected graph G = (V = {v1, . . . , vn}, E). There are a total of n! possible orderingsof these vertices. Pick one such ordering uniformly at random σ = (σ1, . . . , σn). Then consider the following process:Begin with S = ∅. Then, at each step (for i = 1 to n), if for all u ∈ S, (u, vσi) ∈/ E, add vσito S.Denote by d the maximum degree of a vertex of V . Prove that the proposed algorithm achieves an independent setwith expected value of at least 1/d fraction of the optimal solution.arrow_forwardGiven a graph G = (V, E), let us call G an almost-tree if G is connected and G contains at most n + 12 edges, where n = |V |. Each edge of G has an associated cost, and we may assume that all edge costs are distinct. Describe an algorithm that takes as input an almost-tree G and returns a minimum spanning tree of G. Your algorithm should run in O(n) time.arrow_forwardRecall the Clique problem: given a graph G and a value k, check whether G has a set S of k vertices that's a clique. A clique is a subset of vertices S such that for all u, v € S, uv is an edge of G. The goal of this problem is to establish the NP-hardness of Clique by reducing VertexCover, which is itself an NP-hard problem, to Clique. Recall that a vertex cover is a set of vertices S such that every edge uv has at least one endpoint (u or v) in S, and the VertexCover problem is given a graph H and a value 1, check whether H has a vertex cover of size at most 1. Note that all these problems are already phrased as decision problems, and you only need to show the NP-Hardness of Clique. In other words, we will only solve the reduction part in this problem, and you DO NOT need to show that Clique is in NP. Q4.1 Let S be a subset of vertices in G, and let C be the complement graph of G (where uv is an edge in C if and only if uv is not an edge in G). Prove that for any subset of vertices…arrow_forward
- Consider an undirected graph G = (V;E). An independent set is a subset I V such that for any vertices i; j 2 I, there is no edge between i and j in E. A set i is a maximal independent set if no additional vertices of V can be added to I without violating its independence. Note, however, that a maximal independent sent is not necessarily the largest independent set in G. Let (G) denote the size of the largest maximal independent set in G. Consider the following greedy algorithm for generating maximal independent sets: starting with an empty set I, process the vertices in V one at a time, adding v to I is v is not connected to any vertex already in I. 2) Argue that the output I of this algorithm is a maximal independent set.arrow_forwardConsider a graph G that is comprised only of non-negative weight edges such that (u, v) € E, w(u, w) > 0. Is it possible for Bellman-Ford and Dijkstra's algorithm to produce different shortest path trees despite always producing the same shortest-path weights? Justify your answer.arrow_forwardWe are given a simple connected undirected graph G = (V, E) with edge costs c : E → R+. We would like to find a spanning binary tree T rooted a given node r ∈ T such that T has minimum weight. Consider the following modifiedPrim algorithm that works similar to Prim’s MST algorithm: We maintain a tree T (initially set to be r by itself) and in each iteration of the algorithm, we grow T by attaching a new node T in the cheapest possible way such that we do not violate the binary constraint; if it is not possible to grow the tree, we declare the instance to be infeasible.1: function modifiedPrim(G=(V, E), r)2: T ← {r}3: while |T| < |V| do4: S ← {u ∈ V : u ∈ T and |children(u)| < 2}5: R ← {u ∈ V : u ∈/ T}6: if ∃ (u, v) ∈ E with u ∈ S and v ∈ R then7: let (u, v) be the minimum cost such edge8: Add (u, v) to T9: else10: return infeasible11: return THow would you either prove the correctness of modifiedPrim or provide a counter-example where it fails to return the correct answer.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education