#include <iostream>
using namespace std;
void swap(int &a,int &b)
{
int t;
t=a;
a=b;
b=t;
}
void show(int *a,int length)
{
int i;
for (i=0;i<length;i++)
cout<<a[i]<<" ";
cout<<endl;
}
void Insert_Sort(int *a,int length)
{
int i,j;
cout<<"......using insert_sort....."<<endl;
for(i=1;i<length;i++)
for(j=i;j>0;j--)
{
if(a[j]<a[j-1])
swap(a[j-1],a[j]);
}
}
void Bubble_Sort(int *a,int length)
{
int i,j;
cout<<"......using bubble_sort....."<<endl;
for(i=0;i<length;i++)
for(j=i;j<length-1;j++)
{
if(a[j]>a[j+1])
swap(a[j],a[j+1]);
}
}
void Selection_Sort(int *a,int length)
{
int i,j;
cout<<"......using selection_sort....."<<endl;
for(i=0;i<length;i++)
{
int Min=i;
for(j=i;j<length-1;j++)
if(a[j]<a[Min])
Min=j;
swap(a[i],a[Min]);
}
}
void main()
{
int a[100],n,i;
//clock_t start,end;
cout<<"please input the nummber of the array:"<<endl;
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
cout<<endl;
show(a,n);
Insert_Sort(a,n);
show(a,n);
Bubble_Sort(a,n);
show(a,n);
Selection_Sort(a,n);
show(a,n);
}