示例#1
0
 def test_compress_path(self):
     s = DisjointSet(10)
     s.union(1, 2)
     s.union(3, 4)
     s.union(1, 3)
     self.assertEqual(s.getPath(1), [1, 2, 4])
     s.find(1)
     self.assertEqual(s.getPath(1), [1, 4])