Tag: union-find
Min Cost to Connect All Points
Date: 2/27/2024Tags:algorithmsleetcodeunion-findgraphminimum_spanning_treeThis journal entry discusses the application of Kruskal's algorithm to find the minimum cost to connect all points in a 2D plane using Union-Find data structure for tracking connected points and sorting edges based on Manhattan distances.
Some thoughts on Union-Find algorithm
Date: 1/22/2024Tags:algorithmsunion-findThe journal entry explores the concept of Union-Find algorithm and its application in grouping elements, with an accompanying image.
Lexicographically Smallest Equivalent String #2 attempt
Date: 1/22/2024Tags:algorithmsleetcodeunion-findThe journal entry explains a mistake made in the attempt to solve the Lexicographically Smallest Equivalent String problem, where the incorrect assignment of roots in the union function caused only a single element to be moved instead of the entire group. The code provided is a solution to this problem using a UnionFind class.
Lexicographically Smallest Equivalent String
Date: 1/20/2024Tags:algorithmsleetcodeunion-findThis journal entry discusses the problem of finding the lexicographically smallest equivalent string and presents a solution using the Union-Find algorithm implemented with a code snippet.
Number of Unique Categories #2 attempt
Date: 1/20/2024Tags:algorithmsleetcodeunion-findIn this journal entry, the author shares lessons learned from their second attempt at solving the "Number of Unique Categories" problem, emphasizing the use of the `roots` property in the code to optimize the performance of finding the root in the Union-Find algorithm, and provides a code implementation of the Union-Find algorithm to find the number of unique categories.