Groups
Category
An invariant is a property you promise to keep true throughout an algorithm, and it is the anchor of both design and correctness proofs.
Kruskalโs algorithm builds a minimum spanning tree (MST) by sorting all edges by weight and greedily picking the next lightest edge that does not form a cycle.