algorithms – How does quicksort handle case when we choose the first number as pivot and all the remaining elements after the pivot is greater


For example, we have an array [4,7,6,13] and I choose the first item 4 as the pivot. Now I have a pointer i that goes through the array from index 1 to index 3; and I have another pointer j that starts at index 1, increases whenever we find an element that is smaller than pivot and we swap this element with the element j is now pointing to. Now since all elements are greater than 4, when my i reaches the end of the array, j is still at index 1. Now I have to switch 4 and 7, which doesn’t make sense. However, according to the algorithm, we need to swap them. Did I miss anything here?