Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve a DAG 3 times with each algorithm then show they fail Problem 2 (20 points) 1. [15 points] Consider a DAG which has already

image text in transcribed

Solve a DAG 3 times with each algorithm then show they fail

Problem 2 (20 points) 1. [15 points] Consider a DAG which has already been topologically sorted, so edges go from left to right. In the lecture notes, we have seen a Dynamic Programming algorithm that finds the shortest path in a DAG where edges have weights associated with them. Now consider the following greedy strategies. Show that all of them fail to find the shortest path from node 1 to node n by giving appropriate small examples. You should also explain what is the value of the optimal solution compared to the greedy one. Greedy strategy 1 Set i=1 While itn, Pick the edge (i, j) with the largest j Set i=j and repeat Return the weight of the path constructed from node 1 to node n. Greedy strategy 2 Set i=1 . While ihn, Pick the edge (i, j) with the smallest weight Set i=j and repeat Return the weight of the path constructed from node 1 to node n. Greedy strategy 3 Set i=1 While itn, Pick the edge (i, j) with the smallest ratio weight/(-i) Set i=j and repeat Return the weight of the path constructed from node 1 to node n

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

More Books

Students also viewed these Databases questions

Question

How is the weighted average cost of capital determined?

Answered: 1 week ago