Articles for author: Bikash Daga

Unbounded Knapsack

Problem Statement Given a knapsack weight W and a set of N items with certain values(benefit or profit) val, and weights wt, find the maximum amount that could make up the exact knapsack weight.In Unbounded Knapsack, you may select an item multiple times. Example N = 4 W = 10 val[] = {15, 25, 20, ...

Johnson’s Algorithm for All-Pair Shortest Path

Johnson’s Algorithm is used to find all pair shortest path in a graph. We can use the Johnson’s Algorithm to find the shortest paths between all pairs of vertices in an edge-weighted directed graph. Johnson’s Algorithm uses both Dijkstra's Algorithm and Bellman-Ford Algorithm. Johnson’s Algorithm can find the all pair shortest path even in the ...