Exemple #1
0
        /// <summary>
        /// This method sorts data array by merge sort.
        /// </summary>
        /// <param name="arrayForSort">Data array for sort.</param>
        public static void Sort(int[] arrayForSort)
        {
            InputVerification.VerifyInputCorrect(arrayForSort);

            int[] buffer = ArrayDivisionAndSort(arrayForSort);

            for (int i = 0; i < arrayForSort.Length; i++)
            {
                arrayForSort[i] = buffer[i];
            }
        }
        /// <summary>
        /// This method sorts data array by merge sort.
        /// </summary>
        /// <param name="arrayForSort">Data array for sort.</param>
        public static void Sort(int[] arrayForSort)
        {
            InputVerification.VerifyInputCorrect(arrayForSort);

            SortingAlgorithm(arrayForSort, 0, arrayForSort.Length - 1);
        }