一个并查集对象

实现并查集的查找、合并、类别size class UF{ constructor(n){ this.parent=Array(n) this.size=[] for (let i = 0; i < n; i++) { this.parent[i] = i; this.size[i] = 1; } }
posted @ 2022-12-14 20:38  无工时代  阅读(12)  评论(0编辑  收藏  举报