Question: Given a directed graph with non-negative integer edge weights, a pair of vertices s and t, and integers K and W, describe a dynamic-programming algorithm

Given a directed graph with non-negative integer edge weights, a pair of vertices s and t, and integers K and W, describe a dynamic-programming algorithm for deciding whether there exists a path from s to t that has total weight W and uses exactly K edges. Your algorithm should run in time O((n + m)WK). Analyze the time- and space-complexity of your solution. Hint: You will have to define a three-dimensional table for the recurrence relation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
