public void DemoTest()
        {
            IUnionFind uf = new WeightedQuickUnion(10);

            int[] root = new int[10];

            uf.Union(4, 3);
            root = uf.GetIds();
            Assert.AreEqual(4, root[3]);

            uf.Union(3, 8);
            root = uf.GetIds();
            Assert.AreEqual(4, root[8]);

            uf.Union(6, 5);
            root = uf.GetIds();
            Assert.AreEqual(6, root[5]);

            uf.Union(9, 4);
            root = uf.GetIds();
            Assert.AreEqual(4, root[9]);

            uf.Union(2, 1);
            root = uf.GetIds();
            Assert.AreEqual(2, root[1]);

            uf.Union(5, 0);
            root = uf.GetIds();
            Assert.AreEqual(6, root[0]);

            uf.Union(7, 2);
            root = uf.GetIds();
            Assert.AreEqual(2, root[7]);

            uf.Union(6, 1);
            root = uf.GetIds();
            Assert.AreEqual(6, root[2]);

            uf.Union(7, 3);
            root = uf.GetIds();
            Assert.AreEqual(6, root[4]);

            Assert.AreEqual(6, root[0]);
            Assert.AreEqual(2, root[1]);
            Assert.AreEqual(6, root[2]);
            Assert.AreEqual(4, root[3]);
            Assert.AreEqual(6, root[4]);
            Assert.AreEqual(6, root[5]);
            Assert.AreEqual(6, root[6]);
            Assert.AreEqual(2, root[7]);
            Assert.AreEqual(4, root[8]);
            Assert.AreEqual(4, root[9]);
        }
 public static string Question2Seed532465()
 {
     IUnionFind uf = new WeightedQuickUnion(10);
     //9-7 2-0 0-7 5-1 1-6 3-5 1-4 5-2 8-6 
     uf.Union(9, 7);
     uf.Union(2, 0);
     uf.Union(0, 7);
     uf.Union(5, 1);
     uf.Union(1, 6);
     uf.Union(3, 5);
     uf.Union(1, 4);
     uf.Union(5, 2);
     uf.Union(8, 6);
     int[] ids = uf.GetIds();
     string res = string.Join(" ", ids);
     return res;
 }
        public static string Question2Seed532465()
        {
            IUnionFind uf = new WeightedQuickUnion(10);

            //9-7 2-0 0-7 5-1 1-6 3-5 1-4 5-2 8-6
            uf.Union(9, 7);
            uf.Union(2, 0);
            uf.Union(0, 7);
            uf.Union(5, 1);
            uf.Union(1, 6);
            uf.Union(3, 5);
            uf.Union(1, 4);
            uf.Union(5, 2);
            uf.Union(8, 6);
            int[]  ids = uf.GetIds();
            string res = string.Join(" ", ids);

            return(res);
        }