diff --git a/C++/Mergesort.cpp b/C++/Mergesort.cpp new file mode 100644 index 0000000..8c011d6 --- /dev/null +++ b/C++/Mergesort.cpp @@ -0,0 +1,66 @@ +#include +using namespace std; +void swapping(int &a, int &b) { + int temp; + temp = a; + a = b; + b = temp; +} +void display(int *array, int size) { + for(int i = 0; i> n; + int arr[n]; + cout << "Enter elements:" << endl; + for(int i = 0; i> arr[i]; + } + cout << "Array before Sorting: "; + display(arr, n); + mergeSort(arr, 0, n-1); + cout << "Array after Sorting: "; + display(arr, n); +}