Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Faster linearization: In class, we described an algorithm for finding a linearization of a DAG G. The algorithm runs DFS on G, and then outputs

Faster linearization: In class, we described an algorithm for finding a linearization of a DAG G. The algorithm runs DFS on G, and then outputs the vertices in order of decreasing post values. The run time of this algorithm is O(nlog n+m), because it sorts the vertices as a final step. However, this is actually inefficient and there exists an alternate implementation that runs in O(n + m) time. This implementation is a modification of the DFS algorithm to output the ordering during the execution of the DFS algorithm, thereby avoiding the sorting step in the end. (a) (2pt) What linearization is found by the algorithm in class on the following graph? Make sure you run DFS on the vertices in alphabetical order. (b) (8pt) Please write down pseudocode for a modified version of DFS that takes a graph G and outputs vertices in order of decreased post values. Your algorithm should run in O(n+m) time. You must use pseudocode for this problem.image text in transcribed

(10 pts.) Faster linearization: In class, we described an algorithm for finding a linearization of a DAG G. The algorithm runs DFS on G, and then outputs the vertices in order of decreasing post values. The run time of this algorithm is O(nlogn+m), because it sorts the vertices as a final step. However, this is actually inefficient and there exists an alternate implementation that runs in O(n+m) time. This implementation is a modification of the DFS algorithm to output the ordering during the execution of the DFS algorithm, thereby avoiding the sorting step in the end. (a) (2pt) What linearization is found by the algorithm in class on the following graph? Make sure you run DFS on the vertices in alphabetical order. (b) (8pt) Please write down pseudocode for a modified version of DFS that takes a graph G and outputs vertices in order of decreased post values. Your algorithm should run in O(n+m) time. You must use pseudocode for this

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions

Question

What is the relationship between humans?

Answered: 1 week ago

Question

What are Fringe Benefits ? List out some.

Answered: 1 week ago