#include <fstream>
using namespace std;
ifstream is("date.in");
ofstream os("date.out");
void elev_rec(int a[], int n, int i, int j)
{
if(i<n-1)
{
if(a[i]>a[j]) {int aux=a[i]; a[i]=a[j]; a[j]=aux;}
if(j<n-1) elev_rec(a,n,i,j+1);
else elev_rec(a,n,i+1,i+2);
}
}
int main()
{
int a[100],n;
is>>n;
for(int i=0;i<n;i++)
is>>a[i];
elev_rec(a,n,0,1);
for(int i=0;i<n;i++)
os<<a[i]<<" ";
is.close();
os.close();
return 0;
}
|