mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-21 02:53:15 +08:00
Format code with prettier (#3375)
This commit is contained in:
@ -61,19 +61,27 @@ public class UnionFind {
|
||||
// Tests
|
||||
public static void main(String[] args) {
|
||||
UnionFind uf = new UnionFind(5);
|
||||
System.out.println("init /w 5 (should print 'p [0, 1, 2, 3, 4] r [0, 0, 0, 0, 0]'):");
|
||||
System.out.println(
|
||||
"init /w 5 (should print 'p [0, 1, 2, 3, 4] r [0, 0, 0, 0, 0]'):"
|
||||
);
|
||||
System.out.println(uf);
|
||||
|
||||
uf.union(1, 2);
|
||||
System.out.println("union 1 2 (should print 'p [0, 1, 1, 3, 4] r [0, 1, 0, 0, 0]'):");
|
||||
System.out.println(
|
||||
"union 1 2 (should print 'p [0, 1, 1, 3, 4] r [0, 1, 0, 0, 0]'):"
|
||||
);
|
||||
System.out.println(uf);
|
||||
|
||||
uf.union(3, 4);
|
||||
System.out.println("union 3 4 (should print 'p [0, 1, 1, 3, 3] r [0, 1, 0, 1, 0]'):");
|
||||
System.out.println(
|
||||
"union 3 4 (should print 'p [0, 1, 1, 3, 3] r [0, 1, 0, 1, 0]'):"
|
||||
);
|
||||
System.out.println(uf);
|
||||
|
||||
uf.find(4);
|
||||
System.out.println("find 4 (should print 'p [0, 1, 1, 3, 3] r [0, 1, 0, 1, 0]'):");
|
||||
System.out.println(
|
||||
"find 4 (should print 'p [0, 1, 1, 3, 3] r [0, 1, 0, 1, 0]'):"
|
||||
);
|
||||
System.out.println(uf);
|
||||
|
||||
System.out.println("count (should print '3'):");
|
||||
|
Reference in New Issue
Block a user