We know that the element with rank r is somewhere between index i and index j. We partition and find the pivot element at position k. We only need to recurse on the left partition.