This question evaluates understanding and implementation of the Disjoint Set Union (Union-Find) data structure—including path compression and union by rank—and competency in processing online connectivity queries on undirected graphs, categorized under Coding & Algorithms in the graph algorithms and data structures domain.
Implement a Disjoint Set Union (Union-Find) data structure with path compression and union by rank. Support operations: make_set, find(x), union(x, y), and connected(x, y). Then, given an undirected graph with n nodes labeled 1..n and a list of edges, process q online connectivity queries efficiently. Analyze time and space complexity, and discuss edge cases such as duplicate unions and isolated nodes.