diff --git a/sorting/merge_sort.cpp b/sorting/merge_sort.cpp index 34600d06a..fc6d66af5 100644 --- a/sorting/merge_sort.cpp +++ b/sorting/merge_sort.cpp @@ -1,11 +1,11 @@ /** * \addtogroup sorting Sorting Algorithms - * @file{ + * @{ * \file - * \breif [Merege Sort Algorithm + * \brief [Merege Sort Algorithm * (MEREGE SORT)](https://en.wikipedia.org/wiki/Merge_sort) implementation * - * \author [Ayaan Khan] (http://github.com/ayaankhan98) + * \author [Ayaan Khan](http://github.com/ayaankhan98) * * \details * Merge Sort is an efficient, general purpose, comparison @@ -22,16 +22,15 @@ * arr[l..m] and arr[m+1..r] are sorted and merges the two * sorted sub-arrays into one. * - * @param arr[] is the array with two halves one is arr[l...m] and - * other is arr[m+1...l] - * @param l is the left index of first half array - * @param m is the end index of right index of first half array + * @param arr - array with two halves arr[l...m] and arr[m+1...l] + * @param l - left index or start index of first half array + * @param m - right index or end index of first half array * * (The second array starts form m+1 and goes till l) * - * @param l is the end index of right index of second half array + * @param l - end index or right index of second half array */ -void merge(int arr[], int l, int m, int r) { +void merge(int *arr, int l, int m, int r) { int i, j, k; int n1 = m - l + 1; int n2 = r - m; @@ -76,12 +75,12 @@ void merge(int arr[], int l, int m, int r) { * input array into two halves and calls itself for the two halves * and then calls merge() to merge the two halves * - * @param arr[] the array which is to be sorted - * @param l define the left index of array - * @param r defines the right index of array + * @param arr - array to be sorted + * @param l - left index or start index of array + * @param r - right index or end index of array * */ -void mergeSort(int arr[], int l, int r) { +void mergeSort(int *arr, int l, int r) { if (l < r) { int m = l + (r - l) / 2; mergeSort(arr, l, m); @@ -91,10 +90,10 @@ void mergeSort(int arr[], int l, int r) { } /** - * A simple utility function used to print the array after + * Utility function used to print the array after * sorting */ -void show(int arr[], int size) { +void show(int *arr, int size) { for (int i = 0; i < size; i++) std::cout << arr[i] << " "; std::cout << "\n"; }