Category Archives: AOAD

Constructing The Minimum Spanning Tree for a Graph using Kruskal’s Algorithm

Kruskal’s algorithm is a minimum-spanning-tree algorithm where the algorithm finds an edge of the least possible weight that connects any two trees in the forest. It is a greedy algorithm in graph theory as it finds a minimum spanning tree for a connected weighted graph at each step.

Continue reading Constructing The Minimum Spanning Tree for a Graph using Kruskal’s Algorithm

Implementing Greedy Knapsack Algorithm in Java

According to Wikipedia,

The knapsack problem or rucksack problem is a problem in combinatorial optimization: Given a set of items, each with a mass and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible.

Continue reading Implementing Greedy Knapsack Algorithm in Java