Пример #1
0
        public Set Union(Set c2)
        {
            Set c = new Set();
            for (int i = 0; i < this.NumberofElements(); i++)
                c.Add(this.Element(i + 1));
            for (int i = 0; i < c2.NumberofElements(); i++)
                if (!c.Contains(c2.Element(i + 1)))
                    c.Add(c2.Element(i + 1));

            return (c);
        }
Пример #2
0
        public Set Intersection(Set c2)
        {
            Set c = new Set();
            for (int i = 0; i < this.NumberofElements(); i++)
                if (c2.Contains(this.Element(i + 1)))
                    c.Add(this.Element(i + 1));

            return (c);
        }
Пример #3
0
        public Set Substract(Set c2)
        {
            Set c3 = new Set(); Set c = new Set();
            c3 = this.Intersection(c2);
            for (int i = 0; i < this.NumberofElements(); i++)
                if (c3.Contains(this.Element(i + 1)) == false)
                    c.Add(this.Element(i + 1));

            return (c);
        }