Algorithms
Posted: Fri May 20, 2022 12:45 pm
Algorithms
3. (4 points) Consider the knapsack problem with n objects whose profits and weights are pi={10, 15, 25, 12} and wi{1,2,3,2}, respectively. The capacity constraint is W=5. solve this problem using greedy algorithm, try to find the optimal solution. 4. (3 points) Consider a weighted undirected graph G (V, E) where the weight of each edge =1. Write an algoritim that takes O(IVI + El) time to solve the single source shortest path problem.
3. (4 points) Consider the knapsack problem with n objects whose profits and weights are pi={10, 15, 25, 12} and wi{1,2,3,2}, respectively. The capacity constraint is W=5. solve this problem using greedy algorithm, try to find the optimal solution. 4. (3 points) Consider a weighted undirected graph G (V, E) where the weight of each edge =1. Write an algoritim that takes O(IVI + El) time to solve the single source shortest path problem.