Esempio n. 1
0
        public static int GetIdentityNo(List <int> list)
        {
            if (list.Count == 0)
            {
                return(1);
            }

            BubbleSorter.Sort(list,
                              (int n1, int n2) => { return(n1 < n2); });

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i] != i + 1)
                {
                    return(i + 1);
                }
            }

            return(list.Count + 1);
        }
Esempio n. 2
0
        public static int GetIdentityNo(int[] arySource)
        {
            if (arySource.Length == 0)
            {
                return(1);
            }

            BubbleSorter.Sort(arySource,
                              (int n1, int n2) => { return(n1 < n2); });

            for (int i = 0; i < arySource.Length; i++)
            {
                if (arySource[i] != i + 1)
                {
                    return(i + 1);
                }
            }

            return(arySource.Length + 1);
        }