Question: 9 . 1 9 . 2 9 . 3 9 . 4 9 . 5 9 . 6 9 . 7 Find a topological ordering
Find a topological ordering for the graph in Figure
If a stack is used instead of a queue for the topological sort algorithm in Section does a different ordering result? Why might one data structure give a better answer?
Write a program to perform a topological sort on a graph.
An adjacency matrix requires OV merely to initialize using a standard double loop. Propose a method that stores a graph in an adjacency matrix so that testing for the existence of an edge is O but avoids the quadratic running time.
a Find the shortest path from A to all other vertices for the graph in Figure b Find the shortest unweighted path from B to all other vertices for the graph in
Figure
What is the worstcase running time of Dijkstras algorithm when implemented
with dheaps Section
a Give an example where Dijkstras algorithm gives the wrong answer in the presence of a negative edge but no negativecost cycle.
b Show that the weighted shortestpath algorithm suggested in Section works if there are negativeweight edges, but no negativecost cycles, and that the running time of this algorithm is OEV
ABC
Exercises sDEFt
GHI
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
