From c7aa6ff2a55ac1ae88e4ea1912c4ae58c8edae50 Mon Sep 17 00:00:00 2001 From: Preetraj Haldar <75788789+the-threshold-frequency@users.noreply.github.com> Date: Sun, 2 Oct 2022 12:07:01 +0530 Subject: [PATCH] Add files via upload --- merge_sort.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 merge_sort.cpp diff --git a/merge_sort.cpp b/merge_sort.cpp new file mode 100644 index 0000000..a693944 --- /dev/null +++ b/merge_sort.cpp @@ -0,0 +1,65 @@ +#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); +} \ No newline at end of file