Exemplo n.º 1
0
        public void printSets()
        {
            DJSets djSets = new DJSets();

            for (int i = 0; i < parents.Length; ++i)
            {
                if (parents[i] != 0)
                {
                    int root = findset(i);
                    if (!djSets.inDJSets(root))
                    {
                        djSets.addSet(root);
                        djSets.insertIntoSet(root, i);
                    }
                    else
                    {
                        djSets.insertIntoSet(root, i);
                    }
                }
            }
            djSets.printSets();
        }
Exemplo n.º 2
0
        public void printSets()
        {
            DJSets djSets = new DJSets();

            for (int i = 0; i < parents.Length; ++i)
            {
                if (parents[i] != 0)
                {
                    int root = findset(i);
                    if (!djSets.inDJSets(root))
                    {
                        djSets.addSet(root);
                        djSets.insertIntoSet(root, i);
                    }
                    else
                    {
                        djSets.insertIntoSet(root, i);
                    }
                }
            }
            djSets.printSets();
        }