Its a step to make quickselect
I already have swap written but i dont know how to write this
int partition(int f, int l) {
int pivot = v[l];
int i = f;
for (int j = f; j < l; j++)
if (v[j] < pivot)
swap(i++,j);
swap(i, l );
return (i);
}
Thanks in advance!
chat gpt doesnt work ive tried
New contributor
Papiras is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3