From b799725156e9448c20a5bdf0fe1fc67fa5fe9619 Mon Sep 17 00:00:00 2001 From: 0701MF20 <72437159+0701MF20@users.noreply.github.com> Date: Thu, 23 Sep 2021 17:25:33 +0530 Subject: [PATCH] updated sorting --- SORTING | 110 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 97 insertions(+), 13 deletions(-) diff --git a/SORTING b/SORTING index 5918c98..0380e8b 100644 --- a/SORTING +++ b/SORTING @@ -1,5 +1,7 @@ #include #include +#include//time +#include//for sleep #define size 10 //shell sort void swap(int *x,int *y) @@ -70,6 +72,52 @@ for(exp=1;m/exp>0;exp*=10) countSort(A,n,exp); } } +//merge new technique-corrected +void merge(int A[],int l,int h,int mid) //we have to use mid otherwise 1 element will not get sorted and thius it will by default assign 0 +{ + int B[20]; + int i,j; +// int mid=(l+h)/2; + int k=mid+1; + i=l; + j=l; + while(i<=mid&&k<=h) + { + if(A[i]=0 && A[j]>x) + while(j>-1&& A[j]>x) { A[j+1]=A[j]; j--; } A[j+1]=x; + for(k=0;kA[j+1]) swap(&A[j],&A[j+1]); } +printf("Pass %d :\n",i); +for(k=0;k