Question: 5. (3 points) You are given a directed acyclic graph G = (V. E) in which each node u eV has an associated price, denoted

5. (3 points) You are given a directed acyclic graph G = (V. E) in which each node u eV has an associated price, denoted by price(u), which is a positive integer. The cost of a node u, denoted by cost(u), is defined to be the price of the cheapest node reachable from u (including u itself). Design an algorithm that computes cost(u) for all u EV. Give pseudocode, discuss running time, and give proof of correctness
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
