//Program Using Shell Sort
include
using namespace std;
main()
{
int arr[5]={4,2,7,1,9};
int i,j,k,num=5,t;
for(i=num/2;i>0;i=i/2)
{
for(j=i;j=0;k=k-i)
{
if(arr[k+i]>=arr[k])
break;
else
{
t=arr[k];
arr[k]=arr[k+1];
arr[k+1]=t;
}
}
}
}
for(int d=0;d<num;d++)
cout << arr[d] << endl;
}
include
using namespace std;
main()
{
int arr[5]={4,2,7,1,9};
int i,j,k,num=5,t;
for(i=num/2;i>0;i=i/2)
{
for(j=i;j=0;k=k-i)
{
if(arr[k+i]>=arr[k])
break;
else
{
t=arr[k];
arr[k]=arr[k+1];
arr[k+1]=t;
}
}
}
}
for(int d=0;d<num;d++)
cout << arr[d] << endl;
}
include
ReplyDeleteusing namespace std;
main()
{
int arr[5]={4,2,7,1,9};
int i,j,k,num=5,t;
for(i=num/2;i>0;i=i/2)
{
for(j=i;j=0;k=k-i)
{
if(arr[k+i]>=arr[k])
break;
else
{
t=arr[k];
arr[k]=arr[k+1];
arr[k+1]=t;
}
}
}
}
for(int d=0;d<num;d++)
cout << arr[d] << endl;
}
//Md. Monwar Hossain
ReplyDelete//Id. 201330705, Batch-44,
#include
using namespace std;
main()
{
int data[5]={9,6,3,7,2},mennath,len;
cin>>len;
for(int i=len/2;i>0;i=i/2)
{
for(int j=i;j=0;k=k-i)
{
if(data[k+i]>=data[k])
break;
else
{
mennath=data[k];
data[k]=data[k+1];
data[k+1]=mennath;
}
}
}
}
for(int m=0;m<len;m++)
cout<<"\n"<<data[m];
}
#include
ReplyDeleteusing namespace std;
int main()
{
int a[5]={9,6,3,7,2};
int num=5,temp;
for(int i=num/2;i>0;i=i/2)
{
for(int j=i;j=0;k=k-i)
{
if(a[k+i]>a[k])
break;
else
{
temp=a[k];
a[k]=a[k+1];
a[k+1]=temp;
}
}
}
}
for(int d=0;d<num;d++)
cout<<"\n"<<a[d];
}
#include
ReplyDeleteusing namespace std;
main()
{
int a[5]={1,3,2,6,7};
int num = 5, temp;
for(int i=num/2 ;i>0; i=i/2 )
{
for(int j=i;j0; k=k-i)
{
if (a[k+i]>=a[k])
break;
else
{
temp=a[k];
a[k]=a[k+i];
a[k+i]=temp;
}
}
}
}
for(int d=0; d<num; d++)
cout <<a[d]<<endl;
}
#include
ReplyDeleteusing namespace std;
main()
{
int a[5]={1,3,2,6,7};
int num = 5, temp;
for(int i=num/2 ;i>0; i=i/2 )
{
for(int j=i;j0; k=k-i)
{
if (a[k+i]>=a[k])
break;
else
{
temp=a[k];
a[k]=a[k+i];
a[k+i]=temp;
}
}
}
}
for(int d=0; d<num; d++)
cout <<a[d]<<endl;
}