diff --git a/DataStructures/Graphs/Kruskal.java b/DataStructures/Graphs/Kruskal.java index 58b8d89eb..82fdf3912 100644 --- a/DataStructures/Graphs/Kruskal.java +++ b/DataStructures/Graphs/Kruskal.java @@ -1,4 +1,9 @@ -package Kruskal; +//Problem -> Connect all the edges with the minimum cost. +//Possible Solution -> Kruskal Algorithm (KA), KA finds the minimum-spanning-tree, which means, the group of edges with the minimum sum of their weights that connect the whole graph. +//The graph needs to be connected, because if there are nodes impossible to reach, there are no edges that could connect every node in the graph. +//KA is a Greedy Algorithm, because edges are analysed based on their weights, that is why a Priority Queue is used, to take first those less weighted. +//This implementations below has some changes compared to conventional ones, but they are explained all along the code. +//In case you need to know anyhing else, I would be willing to answer all your doubts, you can contact me by https://www.linkedin.com/in/marcosvillacanas/ import java.util.Comparator; import java.util.HashSet;