hey sir , i want to ask why my code is not running correctly if i am using this function:-
int partion(int a[],int s ,int e )
{
int pivot = a[e];
int i = s-1;
for(int j = s; j < e; j++)
{
if(a[j]<= a[e])
{
i++;
swap(a[i],a[j]);
}
}
swap(a[i+1],pivot);
return i+1;
}
but giving me correct result if i am using
int partion(int a[],int s ,int e )
{
int i = s-1;
for(int j =s ;j < e;j++){
if(a[j]<= a[e])
{
i++;
swap(a[i],a[j]);
}
}
swap(a[i+1],a[e]);
return i+1;
}