You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
271 B
12 lines
271 B
|
4 months ago
|
/**
|
||
|
|
* 并查集 Disjoint set to support quick union
|
||
|
|
*/
|
||
|
|
export default class UnionFind {
|
||
|
|
count: number;
|
||
|
|
parent: {};
|
||
|
|
constructor(items: (number | string)[]);
|
||
|
|
find(item: any): any;
|
||
|
|
union(a: any, b: any): void;
|
||
|
|
connected(a: any, b: any): boolean;
|
||
|
|
}
|