#include
#include
int n;
class quicksort
{
public:
int a[10];
void input();
void qsort(int,int);
void output();
void swap(int &,int &);
int median(int,int);
};
void quicksort::input()
{
int i;
cout cout cout cin>>n;
cout for(i=0;i cin>>a[i];
}
int quicksort::median(int left,int right)
{
int center=(left+right)/2;
if(a[center] swap(a[left ],a[center]);
if(a[right] swap(a[left],a[right]);
if(a[right] swap(a[center],a[right]);
swap(a[center],a[right-1]);
return(a[right-1]);
}
void quicksort::output()
{
cout for(int i=0;i cout }
void quicksort::swap(int &a,int &b)
{
int t;
t=a;
a=b;
b=t;
}
void quicksort::qsort(int left,int right)
{
if(left {
int pivot=median(left,right);
int i=left,j=right-1;
for(;;)
{
while(a[++i] while(pivot if(i swap(a[i],a[j]);
else
break;
}
if(i swap(a[i],a[right-1]);
...