Question: Consider the following procedure whose input is an undirected graph G. Edges of G are represented by an adjacency LIST. weight(vi, vj) is a positive

Consider the following procedure whose input is an undirected graph G. Edges of G are represented by an adjacency LIST. weight(vi, vj) is a positive weight assigned to edge (vi, vj) procedure Proc2(G) 1 Q.Init; 2 foreach vertex vi E V(G) do Q is a min priority queue implemented as a heap */ foreach edge (vi, vj) incident on v; do w ? weight(vi,y); Q.Insert(w); 4 5 6end end s while (Q.IsNotEmpty) do 10Print w; 11 end Let n be the number of vertices of G and let m be the number of edges of G (a) Analyze lines 1-7 of Proc2 giving a bound on their asymptotic running time in terms of n and m (b) Analyze lines 8-11 of Proc2 giving a bound on their asymptotic running time in terms of n and m c) Give the asymptotic running time of Proc2 in terms of n and m Consider the following procedure whose input is an undirected graph G. Edges of G are represented by an adjacency LIST. weight(vi, vj) is a positive weight assigned to edge (vi, vj) procedure Proc2(G) 1 Q.Init; 2 foreach vertex vi E V(G) do Q is a min priority queue implemented as a heap */ foreach edge (vi, vj) incident on v; do w ? weight(vi,y); Q.Insert(w); 4 5 6end end s while (Q.IsNotEmpty) do 10Print w; 11 end Let n be the number of vertices of G and let m be the number of edges of G (a) Analyze lines 1-7 of Proc2 giving a bound on their asymptotic running time in terms of n and m (b) Analyze lines 8-11 of Proc2 giving a bound on their asymptotic running time in terms of n and m c) Give the asymptotic running time of Proc2 in terms of n and m
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
