Exemple #1
0
        public static List <Model_Data> MergeSort_Base(List <Model_Data> Data, TpOperation Field)
        {
            if (Data.Count <= 1)
            {
                return(Data);
            }

            var left  = new List <Model_Data>();
            var right = new List <Model_Data>();

            int middle = Data.Count / 2;

            for (int i = 0; i < middle; i++)
            {
                left.Add(Data[i]);
            }
            for (int i = middle; i < Data.Count; i++)
            {
                right.Add(Data[i]);
            }

            left  = MergeSort_Base(left, Field);
            right = MergeSort_Base(right, Field);
            return(Merge(left, right, Field));
        }
Exemple #2
0
        private static List <Model_Data> Merge(List <Model_Data> Left, List <Model_Data> Right, TpOperation Field)
        {
            switch (Field)
            {
            case TpOperation.integers:
                return(MergeInt(Left, Right));

            case TpOperation.decimals:
                return(MergeFloat(Left, Right));

            case TpOperation.booleans:
                return(MergeBool(Left, Right));

            case TpOperation.text:
                return(MergeText(Left, Right));

            case TpOperation.caracters:
                return(MergeChar(Left, Right));
            }
            return(null);
        }