Question: #2 Constructing and extracting the solution for Longest Path (10 pts) In the following you use the posted solution to LongestPathValueMemoized from class last week.

 #2 Constructing and extracting the solution for Longest Path (10 pts)

#2 Constructing and extracting the solution for Longest Path (10 pts) In the following you use the posted solution to LongestPathValueMemoized from class last week. (a) (3 pts) Rewrite LongestPathValueMemoized to LongestPathMemoized that takes an additional parameter next[i.. IVl ], and records the next vertex in the path from any given vertex u in next [u]. Assume that all entries of next are initialized to1 by the caller. (b) (3 pts) Once that is done, write a procedure that recovers (e.g., prints) the path from s to t by tracing through next, (c) (2 pts) What is the asymptotic runtime of your total solution to the Longest Path problem in terms of [VI and IEl? Include all steps (initializing arrays, LongestPathMemoized, and printing the solution). Hint: Count in aggregate across all calls rather than trying to figure out how many times the loop runs on a given Adj[u]. (d) (2 pts) What is the asymptotic use of space of your solution in terms of VI and IEl? #2 Constructing and extracting the solution for Longest Path (10 pts) In the following you use the posted solution to LongestPathValueMemoized from class last week. (a) (3 pts) Rewrite LongestPathValueMemoized to LongestPathMemoized that takes an additional parameter next[i.. IVl ], and records the next vertex in the path from any given vertex u in next [u]. Assume that all entries of next are initialized to1 by the caller. (b) (3 pts) Once that is done, write a procedure that recovers (e.g., prints) the path from s to t by tracing through next, (c) (2 pts) What is the asymptotic runtime of your total solution to the Longest Path problem in terms of [VI and IEl? Include all steps (initializing arrays, LongestPathMemoized, and printing the solution). Hint: Count in aggregate across all calls rather than trying to figure out how many times the loop runs on a given Adj[u]. (d) (2 pts) What is the asymptotic use of space of your solution in terms of VI and IEl

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 Databases Questions!