11.07.2015 Views

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Sec. 11.7 Exercises 4012 511032041032 611315 5Figure 11.26 Example graph for Chapter 11 exercises.11.16 The single-destin<strong>at</strong>ion shortest-p<strong>at</strong>hs problem for a directed graph is to findthe shortest p<strong>at</strong>h from every vertex to a specified vertex V. Write an algorithmto solve the single-destin<strong>at</strong>ion shortest-p<strong>at</strong>hs problem.11.17 List the order in which the edges of the graph in Figure 11.26 are visitedwhen running Prim’s MST algorithm starting <strong>at</strong> Vertex 3. Show the finalMST.11.18 List the order in which the edges of the graph in Figure 11.26 are visitedwhen running Kruskal’s MST algorithm. Each time an edge is added to theMST, show the result on the equivalence array, (e.g., show the array as inFigure 6.7).11.19 Write an algorithm to find a maximum cost spanning tree, th<strong>at</strong> is, the spanningtree with highest possible cost.11.20 When can Prim’s <strong>and</strong> Kruskal’s algorithms yield different MSTs?11.21 Prove th<strong>at</strong>, if the costs for the edges of Graph G are distinct, then only oneMST exists for G.11.22 Does either Prim’s or Kruskal’s algorithm work if there are neg<strong>at</strong>ive edgeweights?11.23 Consider the collection of edges selected by Dijkstra’s algorithm as the shortestp<strong>at</strong>hs to the graph’s vertices from the start vertex. Do these edges forma spanning tree (not necessarily of minimum cost)? Do these edges form anMST? Explain why or why not.11.24 Prove th<strong>at</strong> a tree is a bipartite graph.11.25 Prove th<strong>at</strong> any tree (i.e., a connected, undirected graph with no cycles) canbe two-colored. (A graph can be two colored if every vertex can be assignedone of two colors such th<strong>at</strong> no adjacent vertices have the same color.)11.26 Write an algorithm th<strong>at</strong> determines if an arbitrary undirected graph is a bipartitegraph. If the graph is bipartite, then your algorithm should also identifythe vertices as to which of the two partitions each belongs to.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!