Quick Sort
SOURCE CODE
#include”stdio.h”
#include”iostream.h”
#include”conio.h”
#include”iomanip.h”
class quick
{
private:
int elements[20],maxsize;
public:
void quicksort(int elements[20],int maxsize);
void sort(int elements[20],int left,int right);
};
void main()
{
int i,maxsize,elements[20];
clrscr();
cout < < "Enter The Number Of Elements : "; cin > > maxsize;
for(i=0;i <> > elements[i];
}
cout < < "Array Before Sorting \n"; cout < < "INDEX \t ELEMENT \n"; for(i=0;i < i="0;i" l="left;" r="right;" pivot="elements[left];"> =pivot)&&(left < pivot="left;" left="l;" right="r;"> pivot)
sort(elements,pivot+1,right);
}