From abbe8e65cb8d6cf150e24adf9e99e4b3e2509c13 Mon Sep 17 00:00:00 2001 From: Pooja-Das <81691805+Pooja-Das@users.noreply.github.com> Date: Thu, 7 Oct 2021 21:45:14 +0530 Subject: [PATCH] Implemented the Merge Sorting using devide and Conquer in C++ --- Merge Sorting using Devide and Conquer | 87 ++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Merge Sorting using Devide and Conquer diff --git a/Merge Sorting using Devide and Conquer b/Merge Sorting using Devide and Conquer new file mode 100644 index 0000000..8f487d3 --- /dev/null +++ b/Merge Sorting using Devide and Conquer @@ -0,0 +1,87 @@ +#include +using namespace std; +int Merge(int A[],int p, int q,int r) +{ + + int n1,n2,i,j,k; + //size of left array=n1 + //size of right array=n2 + n1=q-p+1; + n2=r-q; + int L[n1],R[n2]; + //initializing the value of Left part to L[] + for(i=0;i>n; + int A[n],i; + cout<<"Enter array values:\n"; + for(i=0;i>A[i]; + //Calling the MergeSort() + //First we are passing the array + //the start index that is 0 + //and the size of the array n + + MergeSort(A,0,n-1); + cout<<"The Sorted List is\n"; + for(i=0;i