hi can you please tell me if this is correct?

Code:

void quickSort(int A[], int left, int right){
int i = left, j = right, pivot = A[left];
while(i<=j){
while(i!=(right + 1) && A[i]<=pivot) i++;
while(A[j]>pivot) j--;
if(j>i){
swap(A[i],A[j]);
j--;
i++;
}
}
swap(A[left],A[j]);
if(left<j)
quickSort(A,left,j-1);
if(right>i)
quickSort(A,i,right);
}

im not sure about this part

Code:

while(i!=(right + 1) && A[i]<=pivot) i++;

i put i!=(right + 1)

because for input

3,9,3,8,4

the i will check values from index = 5, 6 of the array which do not exist at all,

but i dont need to check the same thing for j since at most the index of j will be the same of the pivot's index