could anyone please transform this algorithm for quick sort to a program
Algorithm
x is the array,first indicates index of first element& last indicates index of last element.
sort(first,last)
start
if(first<last)
{
pivot=x[first]
i=first
j=last
while(i<j)
{
while(x<=pivot and i<last)
i=i+1
while(x[j]>=pivot and j>first)
j=j-1
if(i<j)
{temp=x
x=x[j]
x[j]=temp
}
}//end of while
temp=x[first]
x[first]=x[j]
x[j]=temp
call sort(first,j-1)
call sort(j+1,last)
}//end of if
Algorithm
x is the array,first indicates index of first element& last indicates index of last element.
sort(first,last)
start
if(first<last)
{
pivot=x[first]
i=first
j=last
while(i<j)
{
while(x<=pivot and i<last)
i=i+1
while(x[j]>=pivot and j>first)
j=j-1
if(i<j)
{temp=x
x=x[j]
x[j]=temp
}
}//end of while
temp=x[first]
x[first]=x[j]
x[j]=temp
call sort(first,j-1)
call sort(j+1,last)
}//end of if