0

Hi, i've tried to get my quicksort to work, but i think because i have been looking at it for so long i cant see the problem with it so if someone can spot my mistake that would be great!

```
int parttition(int myArray[],int first, int last);
void quicksort(int myArray[],int first, int last);
//last=size-1;
void quick( int size)
{
int *myArray;
myArray = (int *) malloc (size * sizeof(int));
myArray= new int [size];
int x;
srand((unsigned)time(0));
for (x=0;x<size;x++)
{
int random_integer = rand()/25;
printf("%d\n",myArray[x]=random_integer);
}
printf("\n\n\n\n");
int first,last;
first=0;
last=size-1;
quicksort( myArray, first, last);
for (x=0;x<size;x++)
{
printf("%d\n",myArray[x]);
}
}
int parttition(int myArray[],int first, int last)
{
int pivot,i,s;
pivot=myArray[last];
i=first;
s=last-1;
int temp1=0,temp2=0,temp3=0;
while( i<=last)
{
if (( myArray[i]>pivot))
{
temp1= myArray[i];
}
i++;
}
while(s>=0)
{
if ( myArray[s]<pivot)
{
temp2= myArray[s];
}
s--;
}
if ( s<i+1)
{
myArray[s]=temp1;
myArray[i-1]=temp2;
}
else
{
return first;
}
temp3=pivot;
pivot=temp1;
myArray[i-1]=myArray[last];
}
void quicksort(int myArray[],int first, int last)
{
int pivot=0;
if (first<last)
{
pivot=parttition(myArray,first, last);
quicksort(myArray,first, pivot-1);
quicksort(myArray,pivot+1, last);
}
}
```