Question: 9 . 1 9 . 2 9 . 3 9 . 4 9 . 5 9 . 6 9 . 7 Find a topological ordering

9.19.2
9.39.4
9.5
9.69.7
Find a topological ordering for the graph in Figure 9.81.
If a stack is used instead of a queue for the topological sort algorithm in Section 9.2, 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 O(|V|2) 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(1)) but avoids the quadratic running time.
a. Find the shortest path from A to all other vertices for the graph in Figure 9.82. b. Find the shortest unweighted path from B to all other vertices for the graph in
Figure 9.82.
What is the worst-case running time of Dijkstras algorithm when implemented
with d-heaps (Section 6.5)?
a. Give an example where Dijkstras algorithm gives the wrong answer in the presence of a negative edge but no negative-cost cycle.
b. Show that the weighted shortest-path algorithm suggested in Section 9.3.3 works if there are negative-weight edges, but no negative-cost cycles, and that the running time of this algorithm is O(|E||V|).
A2B2C 132214
Exercises 437 s4D3E3F3t 6212314
G6H6I

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!