Graph Algorithms


Answer & solution
Answer: O(m α(n)+n) with optimized union-find; O(m log n+n) with balanced-tree bounds (no official key was published)
Initialize n singleton components, scan edges in the given order and use two find operations to test whether each edge crosses components. Accepted edges trigger a union, at most n−1 times. With path compression and union by rank, the total is O(m α(n)+n), since sorting has already been removed. A simpler union-find implementation with logarithmic operations gives O(m log n+n). Reporting only the usual O(m log m) sorting bound would ignore the supplied sorted order. The exact implementation must be stated rather than treating one data-structure bound as universal.