Quicksort
Quicksort
the elements. Repeat the experiment for different values of n, the number of elements in the list
to be sorted and plot a graph of the time taken versus n. The number of elements can be read
from a file or can be generated using random number generator.
# include< stdio.h>
# include <time.h>
# include<stdlib.h>
int partition( int a[], int low, int high)
{
int i, j, temp, key ;
key = a[low];
i= low+1;
j= high;
while(1)
{
while ( i< high && key >=a[i] )
i++;
while ( key < a[j] )
j--;
if (i<j)
{
temp = a[i];
a[i]= a[j];
a[j]=temp;
}
else
{
temp = a[low];
a[low]= a[j];
a[j]=temp;
return j;
}
}
}