/// <summary>
        /// Test whether set1 and set2 has no common element or not
        /// </summary>
        /// <param name="set2"></param>
        /// <returns></returns>
        public bool IsDisjoint( Set set2)
        {
            foreach (int element in list)
            {
                foreach (int i in set2.list)
                {
                    if (i == element)
                    {
                        return false;
                    }
                }
            }

            return true;
        }
        /// <summary>
        /// Test whether set1 and set2 has common element or not
        /// </summary>
        /// <param name="set2"></param>
        /// <returns></returns>
        public bool IsOverlapping(Set set2)
        {
            foreach (int element in list)
            {
                foreach (int i in set2.list)
                {
                    if (i == element)
                    {
                        return true;
                    }
                }
            }

            return false;
        }
        /// <summary>
        /// Do the intersection of two sets
        /// </summary>
        /// <param name="set1"></param>
        /// <param name="set2"></param>
        /// <returns></returns>
        public  Set Intersect(Set set1, Set set2)
        {

            if (set1 == null && set2 == null)
            {
                return new Set();
            }
            else if (set1 == null)
            {
                return (Set)set2.GetClone();
            }
            else if (set2 == null)
            {
                return (Set)set1.GetClone();
            }
            else
            {
                Set newSet = new Set();
                foreach(int element in set1.list)
                {
                   if (set2.Contains(element))
                    {
                      newSet.Add(element);
                    }
                }

                return newSet;
            }
            
        }
        /// <summary>
        /// Substract set2 from set1
        /// </summary>
        /// <param name="set1"></param>
        /// <param name="set2"></param>
        /// <returns></returns>
        public  Set Substract(Set set1, Set set2)
        {
            if (set1 == null)
            {
                return new Set();
            }

            if (set2 == null)
            {
                return (Set)set1.GetClone();
            }

            Set newSet = (Set)set1.GetClone();
            
            foreach (int element in set2.list)
            {
                if (newSet.list.Contains(element))
                {
                    newSet.list.Remove(element);
                }
            
            }

            return newSet;

    
        }
        /// <summary>
        /// Union two sets
        /// </summary>
        /// <param name="set1"></param>
        /// <param name="set2"></param>
        /// <returns></returns>
        public  Set Union(Set set1, Set set2)
        {
            if (set1 == null && set2 == null)
            {
                return new Set();
            }
            else if (set1 == null)
            {
                return (Set)set2.GetClone();
            }
            else if (set2 == null)
            {
                return (Set)set1.GetClone();
            }
            else
            {
                Set newSet = new Set();
                foreach (int element in set1.list) 
                {
                    newSet.Add(element);    
                }

                foreach (int element in set2.list)
                {
                    newSet.Add(element);
                }

                return newSet;
            }
            
       
        }